none
Just Testing RRS feed

  • Question

  • #region CareerObjective
                    else if (SectionName == GeneralModule.CandidateProfileSections.CareerObjective.ToString() && selectedTabIndex == 0)
                    {
                        ProfileCareerObjective = ProfileCareerObjectiveList();
                        if (ProfileCareerObjective.Count() > 0)
                        {
                            ViewData[_profileCareerObjectiveData] = ProfileCareerObjective;
                            ViewData["DoesnotApplyCountDataCareerObjective"] = ProfileCareerObjective.Count();
                            if (ProfileCareerObjective.Count() == 1)
                            {
                                string points = objcandiate_profile.GetSectionWisePoints(objLoginData.LoginID, GeneralModule.CandidateProfileSections.CareerObjective.ToString());
                                ViewData["PointsDataCareerObjective"] = points;
                            }
                            return PartialView(_ProfileCareerObjective);
                        }
                        else
                        {
                            CBSProfileCareerObjective bio = new CBSProfileCareerObjective();
                            ViewData["DoesnotApplyCountDataCareerObjective"] = 0;

                            string points = objcandiate_profile.GetSectionWisePoints(objLoginData.LoginID, GeneralModule.CandidateProfileSections.CareerObjective.ToString());
                            ViewData["PointsDataCareerObjective"] = points;

                            return PartialView(_ProfileCareerObjectiveAddEdit, bio);
                        }
                    }
                    #endregion

    public void ProfileCareerObjectiveAdd(string[] DataObject)
            {
                objLoginData = (LoginData)Session[_LoginData];
                CBSProfileCareerObjective profile = new CBSProfileCareerObjective();
                if (!string.IsNullOrEmpty(DataObject[0].ToString()))
                {
                    profile.CareerObjective = GeneralModule.WordWrap(DataObject[0].ToString().Trim(), 40);
                }
                profile.CandidateID = objLoginData.LoginID;
                profile.CreatedBy = objLoginData.LoginID;
                objcandiateprofile_CareerObjective.AddProfileCareerObjective(profile, ref strMessage);

            }
            /// <summary>
            /// Edit data in Career Objective table
            /// </summary>
            /// <param name="DataObject"></param>
            /// <param name="Primaryvalue"></param>
            public void ProfileCareerObjectiveEdit(string[] DataObject, int? Primaryvalue)
            {
                objLoginData = (LoginData)Session[_LoginData];
                CBSProfileCareerObjective profile = new CBSProfileCareerObjective();
                if (!string.IsNullOrEmpty(DataObject[0].ToString()))
                {
                    profile.CareerObjective = GeneralModule.WordWrap(DataObject[0].ToString().Trim(), 40);
                }
                profile.ProfileCareerObjectiveID = Primaryvalue.Value;
                profile.CandidateID = objLoginData.LoginID;
                profile.ModifiedBy = objLoginData.LoginID;
                objcandiateprofile_CareerObjective.EditProfileCareerObjective(profile, ref strMessage);
            }

    public static IList<SelectListItem> GetListData(string selectedValue, string ListName) { if (selectedValue == null) { selectedValue = string.Empty; } string strListName = string.Empty; strListName = ListName; MFITDDataContext db = new MFITDDataContext(); List<SelectListItem> items = new List<SelectListItem>(); items.Add(new SelectListItem { Text = "Select ", Value = "0" }); //Dictionary<string, string> listnamecollection = null; SelectListItem itemAll = new SelectListItem(); //string DropdownTitle = string.Empty; // List<ListCountry> lstCountry = new List<ListCountry>(); if (!string.IsNullOrEmpty(ListName)) { switch (ListName.ToUpper()) { case "LISTBRANCH": items.AddRange(db.ListBranches.Select(p => new SelectListItem { Text = p.BranchName, Value = p.BranchName, Selected = (p.BranchName == selectedValue ? true : false) }).OrderBy(m => m.Text).ToList()); items[0].Text = "Select Branch"; break; } //foreach (var listcoll in lstCountry) //{ // if (listcoll.CountryName == selectedValue) // { // SelectListItem item = new SelectListItem(); // item.Value = listcoll.CountryName.ToString(); // item.Text = listcoll.CountryName; // item.Selected = true; // items.Add(item); // } // else // { // SelectListItem item = new SelectListItem(); // item.Value = listcoll.CountryName.ToString(); // item.Text = listcoll.CountryName; // item.Selected = false; // items.Add(item); // } //} } else { itemAll.Value = "0"; itemAll.Text = "All"; items.Add(itemAll); } return items; } public class Test { public Test() { } #region Properties public int TestID{ get; set; } #endregion #region Object Declaration #endregion #region Methods public void Add(Test Test, ref string strErrorMsg) { SqlParameter[] sp_Parameters = new SqlParameter[4]; sp_Parameters[0] = new SqlParameter("@TestID", Test.TestID #region Data Execution Process try { objSqlHelper.ExecuteSP("SP_Insert", sp_Parameters, ref strErrorMsg); } catch (Exception ex) { strErrorMsg = ex.Message.ToString(); } #endregion } public void Edit(Test Test, ref string strErrorMsg) { SqlParameter[] sp_Parameters = new SqlParameter[5]; sp_Parameters[0] = new SqlParameter("@Test", Test.TestID); #region Data Execution Process try { objSqlHelper.ExecuteSP("SP_Edit", sp_Parameters, ref strErrorMsg); } catch (Exception ex) { strErrorMsg = ex.Message.ToString(); } #endregion } public void Delete(int id, ref string strErrorMsg) { SqlParameter[] sp_Parameters = new SqlParameter[1]; sp_Parameters[0] = new SqlParameter("@TestID", id); #region Data Execution Process try { objSqlHelper.ExecuteSP("SP_Delete", sp_Parameters, ref strErrorMsg); } catch (Exception ex) { strErrorMsg = ex.Message.ToString(); } #endregion } public IList<Test> GetAllRecords() { List<Test> listadversity = new List<Test>(); DataSet ds = new DataSet(); try { SqlParameter[] sp_Parameters = new SqlParameter[1]; sp_Parameters[1] = new SqlParameter("@TestID", 0); ds = objSqlHelper.GetData("SP_Get", sp_Parameters); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { listadversity = (from j in ds.Tables[0].AsEnumerable() select new Test() { TestID= Convert.ToString(j["TestID"]) }).ToList(); } } } } catch (Exception ex) { throw ex; } return listadversity; } public Test GetData_ByID(int TestID) { Test listTest= new Test(); DataSet ds = new DataSet(); try { SqlParameter[] sp_Parameters = new SqlParameter[2]; sp_Parameters[1] = new SqlParameter("@TestID", TestID); ds = objSqlHelper.GetData("SP_Get", sp_Parameters); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { var queryresult = (from j in ds.Tables[0].AsEnumerable() select j).FirstOrDefault(); if (queryresult != null) { listTest.TestID= queryresult.Table.Rows[0]["TestID"].ToString(); } } } } } catch (Exception ex) { throw ex; } return listTest; } #endregion } } public class SqlHelper { public string ConnectionString= RoleEnvironment.GetConfigurationSettingValue("ConnectionString");//System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; public string MemberShipConnectionString = RoleEnvironment.GetConfigurationSettingValue("MemberShipConnectionString");// System.Configuration.ConfigurationManager.ConnectionStrings["MemberShipConnectionString"].ConnectionString; public SqlConnection objSQLCon; /// <summary> /// SQL Transaction object /// </summary> public SqlTransaction objSQLTran; public string _ConnectionString; public string ConnectionString { get { return _ConnectionString; } set { _ConnectionString = value; } } public SqlHelper() { this._ConnectionString = ConnectionString; } public SqlHelper(string DataBaseName) { if (DataBaseName == "MemberShip") { this._ConnectionString = MemberShipConnectionString; } else { this._ConnectionString = ConnectionString; } } #region Database Methods #region Make Connection public void MakeDBConnection() { this.objSQLCon = new SqlConnection(_ConnectionString); this.objSQLCon.Open(); } #endregion #region Close Connection public void CloseDBConnection() { if (this.objSQLCon != null) { if (this.objSQLCon.State.ToString() != ConnectionState.Closed.ToString()) this.objSQLCon.Close(); this.objSQLCon.Dispose(); this.objSQLCon = null; } } #endregion #region Begin Transaction public void BeginDBTransaction() { this.objSQLTran = this.objSQLCon.BeginTransaction(); } #endregion #region Commit Transaction public void CommitDBTransaction() { this.objSQLTran.Commit(); } #endregion #region Rollback Transaction public void RollbackDBTransaction() { if (this.objSQLTran != null) this.objSQLTran.Rollback(); } #endregion #region Set Command Property public SqlCommand SetCmdProperties(string strStoredProcedureName, CommandType objCommandType,SqlParameter[] objSqlParm) { SqlCommand cmdToExecute = new SqlCommand(); cmdToExecute.CommandText = strStoredProcedureName; cmdToExecute.CommandType = objCommandType; if (objSqlParm != null) { cmdToExecute.Parameters.AddRange(objSqlParm); } cmdToExecute.Connection = this.objSQLCon; cmdToExecute.CommandTimeout = 60; return cmdToExecute; } public SqlCommand SetCmdPropertiesTest(string strStoredProcedureName, CommandType objCommandType, SqlParameter objSqlParm) { SqlCommand cmdToExecute = new SqlCommand(); cmdToExecute.CommandText = strStoredProcedureName; cmdToExecute.CommandType = objCommandType; if (objSqlParm != null) { cmdToExecute.Parameters.Add(objSqlParm); } cmdToExecute.Connection = this.objSQLCon; cmdToExecute.CommandTimeout = 60; return cmdToExecute; } #endregion #region Get Scalar value public object GetScalarValue(string strSQL) { MakeDBConnection(); SqlCommand objSQMComm = new SqlCommand(strSQL, this.objSQLCon); try { object objScalarVal = objSQMComm.ExecuteScalar(); objSQMComm.Dispose(); return objScalarVal; } catch (Exception Ex) { if (objSQMComm != null) { objSQMComm.Dispose(); objSQMComm = null; } throw Ex; } } public object GetScalarValue(string strSQL, SqlParameter[] objSqlPar) { MakeDBConnection(); SqlCommand objSQMComm = SetCmdProperties(strSQL, CommandType.StoredProcedure, objSqlPar); try { object objScalarVal = objSQMComm.ExecuteScalar(); objSQMComm.Dispose(); return objScalarVal; } catch (Exception Ex) { if (objSQMComm != null) { objSQMComm.Dispose(); objSQMComm = null; } throw Ex; } } #endregion #endregion public DataSet GetData(string strSql) { DataSet dsDate = new DataSet(); MakeDBConnection(); SqlDataAdapter objSqlAdp = new SqlDataAdapter(SetCmdProperties(strSql,CommandType.Text,null)); objSqlAdp.Fill(dsDate); objSqlAdp.Dispose(); CloseDBConnection(); return dsDate; } public DataSet GetDataUsingStoredProcedure(string strSql) { DataSet dsDate = new DataSet(); MakeDBConnection(); SqlDataAdapter objSqlAdp = new SqlDataAdapter(SetCmdProperties(strSql, CommandType.StoredProcedure, null)); objSqlAdp.Fill(dsDate); objSqlAdp.Dispose(); CloseDBConnection(); return dsDate; } public DataSet GetData(string strSql, SqlParameter[] objSqlPar) { DataSet dsDate = new DataSet(); MakeDBConnection(); SqlDataAdapter objSqlAdp = new SqlDataAdapter(SetCmdProperties(strSql, CommandType.StoredProcedure, objSqlPar)); objSqlAdp.Fill(dsDate); objSqlAdp.Dispose(); CloseDBConnection(); return dsDate; } public void ExecuteSP(string SPName, SqlParameter[] objSqlPar, ref string strErrorMsg) { MakeDBConnection(); SqlCommand SQLCmd = SetCmdProperties(SPName, CommandType.StoredProcedure, objSqlPar); #region Data Execution Process try { SQLCmd.ExecuteNonQuery(); } catch (Exception ex) { // ************************ Rollback Transaction ************************************** strErrorMsg = ex.Message.ToString(); } finally { CloseDBConnection(); SQLCmd.Dispose(); } #endregion } public void ExecuteSPTran(string SPName, SqlParameter[] objSqlPar, ref string strErrorMsg) { MakeDBConnection(); SqlCommand SQLCmd = SetCmdProperties(SPName, CommandType.StoredProcedure, objSqlPar); #region Data Execution Process try { BeginDBTransaction(); SQLCmd.Transaction = objSQLTran; SQLCmd.ExecuteNonQuery(); CommitDBTransaction(); } catch (Exception ex) { // ************************ Rollback Transaction ************************************** RollbackDBTransaction(); strErrorMsg = ex.Message.ToString(); } finally { CloseDBConnection(); SQLCmd.Dispose(); } #endregion } public void ExecuteSPOutParameterTransaction(ref SqlCommand SQLcmd, string SPName, SqlParameter[] objSqlPar, ref string strErrorMsg) { MakeDBConnection(); SqlCommand SQLCmd = SetCmdProperties(SPName, CommandType.StoredProcedure, objSqlPar); #region Data Execution Process try { BeginDBTransaction(); SQLCmd.Transaction = objSQLTran; SQLCmd.ExecuteNonQuery(); CommitDBTransaction(); } catch (Exception ex) { // ************************ Rollback Transaction ************************************** RollbackDBTransaction(); strErrorMsg = ex.Message.ToString(); } finally { CloseDBConnection(); SQLCmd.Dispose(); } #endregion } public void ExecuteSPOutParameter(ref SqlCommand SQLcmd, string SPName, SqlParameter[] objSqlPar, ref string strErrorMsg) { MakeDBConnection(); SQLcmd = SetCmdProperties(SPName, CommandType.StoredProcedure, objSqlPar); #region Data Execution Process try { SQLcmd.ExecuteNonQuery(); } catch (Exception ex) { // ************************ Rollback Transaction ************************************** strErrorMsg = ex.Message.ToString(); } finally { CloseDBConnection(); SQLcmd.Dispose(); } #endregion } } } function OnClickAdd(mode, sectionname, PrimaryKeyvalue) { generalmode = mode; educationprimarykey = PrimaryKeyvalue; var data_Object = {}; data_Object[0] = document.getElementsByName('ddl')[0].value; data_Object[1] = document.getElementsByName('txtTitle')[0].value; $.ajax({ type: 'Post', url: "/ControllerName/AddEdit", data: { "DataObject": data_Object, "Mode": mode, "PrimaryKeyvalue": Primarykeyvalue, "ProfileEducationID": document.getElementsByName('hidProfileEducationID')[0].value }, datatype: 'html', success: function (data) { $('#screen').css({ "display": "block", "width": "", "height": "" }); $('#divProcessImages').css({ "display": "none" }); $("#Edit").html(data); //$.fn.sfEvalScripts(data); }, error: function (req, status, error) { alert(req.responseText); } }); <%=Html.DropDownList("ddlCountry", ViewData["listcountryData"] as List<SelectListItem>, new { @class = "DropDownList", onkeydown = "fnKeyDown(event)" })%>


    
    
    



    • Edited by hvm2 Wednesday, January 23, 2013 6:43 AM
    Monday, December 17, 2012 6:06 AM

All replies

  • Hi there--

    What is the issue in code? What is the product on that you are writing the solution. By Looking at the code, It doesn't look like a custom code for Project Server related customization.

    Seems that you have erroneously posted your question in a user forum dedicated to customization on Project server  , an enterprise project management tool.  I would suggest that you mention the technology in thread so that we can help to findout the correct forum for you or you may search the correct forum for your question:
    http://social.technet.microsoft.com/Forums/en/categories

    You can also post the question to find :
    http://social.technet.microsoft.com/Forums/en/whatforum/threads

    Hope this helps.  


    If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”. Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    • Marked as answer by hvm2 Monday, December 17, 2012 8:24 AM
    • Unmarked as answer by hvm2 Monday, December 17, 2012 8:49 AM
    Monday, December 17, 2012 8:14 AM