예제 #1
0
파일: DALEmployee.cs 프로젝트: khwwas/SCMS
        public int ChangeImage(SETUP_Employee emp)
        {
            try{
               SCMSDataContext dbSCMS = Connection.Create();
               SETUP_Employee existingSetupmployee = dbSCMS.SETUP_Employees.Where(c => c.Emp_Id.Equals(emp.Emp_Id)).SingleOrDefault();

               if (existingSetupmployee != null){
                   existingSetupmployee.Emp_ImagePath=emp.Emp_ImagePath;
                   dbSCMS.SubmitChanges();
               }
               return Convert.ToInt32(emp.Emp_Id);
               }
               catch{
               return 0;
               }
        }
예제 #2
0
파일: DALEmployee.cs 프로젝트: khwwas/SCMS
        public int Save(SETUP_Employee newSetupEmployee)
        {
            try
               {
               SCMSDataContext dbSCMS = Connection.Create();
               SETUP_Employee existingSetupmployee = dbSCMS.SETUP_Employees.Where(c => c.Emp_Id.Equals(newSetupEmployee.Emp_Id)).SingleOrDefault();
               if (existingSetupmployee != null)
               {
                   existingSetupmployee.Emp_Title = newSetupEmployee.Emp_Title;
                   existingSetupmployee.Emp_DoB = newSetupEmployee.Emp_DoB;
                   existingSetupmployee.Emp_Address = newSetupEmployee.Emp_Address;
                   existingSetupmployee.Emp_AptmentDate = newSetupEmployee.Emp_AptmentDate;
                   existingSetupmployee.Emp_CNIC = newSetupEmployee.Emp_CNIC;
                   existingSetupmployee.Emp_ConfirmDate = newSetupEmployee.Emp_ConfirmDate;
                   existingSetupmployee.Emp_Email = newSetupEmployee.Emp_Email;
                   existingSetupmployee.Emp_JoiningDate = newSetupEmployee.Emp_JoiningDate;
                   existingSetupmployee.Emp_Mobile = newSetupEmployee.Emp_Mobile;
                   existingSetupmployee.Emp_Months_NoticePerd = newSetupEmployee.Emp_Months_NoticePerd;
                   existingSetupmployee.Emp_Months_Probation = newSetupEmployee.Emp_Months_Probation;
                   existingSetupmployee.Emp_Phone = newSetupEmployee.Emp_Phone;
                   existingSetupmployee.Gndr_Id = newSetupEmployee.Gndr_Id;
                   existingSetupmployee.MS_Id = newSetupEmployee.MS_Id;
                   existingSetupmployee.Natn_Id = newSetupEmployee.Natn_Id;
                   existingSetupmployee.Rlgn_Id = newSetupEmployee.Rlgn_Id;

                   existingSetupmployee.Emp_Active = newSetupEmployee.Emp_Active;
                   existingSetupmployee.Emp_SortOrder = newSetupEmployee.Emp_SortOrder;
               }
               else
               {
                   dbSCMS.SETUP_Employees.InsertOnSubmit(newSetupEmployee);
               }
               dbSCMS.SubmitChanges();
               return Convert.ToInt32(newSetupEmployee.Emp_Id);
               }
               catch
               {
               return 0;
               }
        }
예제 #3
0
        public ActionResult SaveEmployee(string Code, string Title, DateTime DoB, string CNIC, string Gender, string MeritalStaus, string Nationality, string Religion, string Address, string Phone, string Mobile, string Email, DateTime AptmentDate, DateTime JoiningDate, DateTime ConfirmDate, string Probation, string NoticePerd, HttpPostedFileBase ProfileImg)
        {
            Int32 li_ReturnValue = 0; string ImageName = "";
            string[] rList = new string[3];
            try
            {
                SETUP_Employee row_Employee = new SETUP_Employee();
                String PevCode = Code;
                if (String.IsNullOrEmpty(Code))
                {
                    if (DALCommon.AutoCodeGeneration("SETUP_Employee") == 1)
                    {
                        Code = DALCommon.GetMaximumCode("SETUP_Employee");
                    }
                }

                if (!String.IsNullOrEmpty(Code))
                {
                    row_Employee.Emp_Id = Code;
                    row_Employee.Emp_Code = Code;
                    row_Employee.Emp_Title = Title;

                    row_Employee.Emp_DoB = DoB;
                    row_Employee.Emp_Address = Address;
                    row_Employee.Emp_AptmentDate = AptmentDate;
                    row_Employee.Emp_CNIC = CNIC;
                    row_Employee.Emp_ConfirmDate = ConfirmDate;
                    row_Employee.Emp_Email = Email;
                    row_Employee.Emp_JoiningDate = JoiningDate;
                    row_Employee.Emp_Mobile = Mobile;
                    row_Employee.Emp_Months_NoticePerd = NoticePerd;
                    row_Employee.Emp_Months_Probation = Probation;
                    row_Employee.Emp_Phone = Phone;
                    row_Employee.Gndr_Id = Gender;
                    row_Employee.MS_Id = MeritalStaus;
                    row_Employee.Natn_Id = Nationality;
                    row_Employee.Rlgn_Id = Religion;

                    row_Employee.Emp_Active = 1;
                    row_Employee.Emp_SortOrder = 1;

                    li_ReturnValue = objDalEmployee.Save(row_Employee);

                    ImageName=ProfileImage(Code, ProfileImg);

                }
            }
            catch {

            }
            rList[0] = li_ReturnValue.ToString();
            rList[1] = Code.ToString();
            rList[2] = ImageName.ToString();
            System.Web.Script.Serialization.JavaScriptSerializer se = new System.Web.Script.Serialization.JavaScriptSerializer();
            string result = se.Serialize(rList);
            Response.Write(result);
            return null;
        }