Esempio n. 1
0
        public int Save(SETUP_EmpPlacement newSetupEmpPlacement)
        {
            try
               {
               SCMSDataContext dbSCMS = Connection.Create();
               SETUP_EmpPlacement existingEmpPlacement = dbSCMS.SETUP_EmpPlacements.Where(c => c.Plcmt_Id.Equals(newSetupEmpPlacement.Plcmt_Id)).SingleOrDefault();
               if (existingEmpPlacement != null)
               {

                   existingEmpPlacement.Dpt_Id = newSetupEmpPlacement.Dpt_Id;
                   existingEmpPlacement.EmpTyp_Id = newSetupEmpPlacement.EmpTyp_Id;
                   existingEmpPlacement.JT_Id = newSetupEmpPlacement.JT_Id;
                   existingEmpPlacement.LevGrp_Id = newSetupEmpPlacement.LevGrp_Id;
                   existingEmpPlacement.LevTyp_Id = newSetupEmpPlacement.LevTyp_Id;
                   existingEmpPlacement.Loc_Id = newSetupEmpPlacement.Loc_Id;
                   existingEmpPlacement.Shft_Id = newSetupEmpPlacement.Shft_Id;

               }
               else
               {
                   dbSCMS.SETUP_EmpPlacements.InsertOnSubmit(newSetupEmpPlacement);
               }
               dbSCMS.SubmitChanges();
               return Convert.ToInt32(newSetupEmpPlacement.Plcmt_Id);
               }
               catch
               {
               return 0;
               }
        }
Esempio n. 2
0
        //Save Placement for Employee
        public ActionResult SavePlacement(string Code, string EmpId, string DptId, string EmpTypId, string JTId, string LevGrpId, string LevTypId, string LocId, string ShftId)
        {
            Int32 li_ReturnValue = 0;

            try
            {
                SETUP_EmpPlacement row_EmpPlacement = new SETUP_EmpPlacement();
                ViewData["EmpId"] = EmpId;
                if (String.IsNullOrEmpty(Code))
                {
                    if (DALCommon.AutoCodeGeneration("SETUP_EmpPlacement") == 1)
                    {
                        Code = DALCommon.GetMaximumCode("SETUP_EmpPlacement");
                    }
                }

                if (!String.IsNullOrEmpty(Code))
                {
                    row_EmpPlacement.Plcmt_Id = Code;
                    row_EmpPlacement.Plcmt_Code = Code;

                    row_EmpPlacement.Emp_Id = EmpId;
                    row_EmpPlacement.Dpt_Id = DptId;
                    row_EmpPlacement.EmpTyp_Id = EmpTypId;
                    row_EmpPlacement.JT_Id = JTId;
                    row_EmpPlacement.LevGrp_Id = LevGrpId;
                    row_EmpPlacement.LevTyp_Id = LevTypId;
                    row_EmpPlacement.Loc_Id = LocId;
                    row_EmpPlacement.Shft_Id = ShftId;

                    li_ReturnValue = objDalEmpPlacement.Save(row_EmpPlacement);
                    Response.Write(Code);
                    return null;
                }
            }
            catch
            {
                Response.Write("" + li_ReturnValue);
            }

            Response.Write("" + li_ReturnValue);
            return null;
        }