コード例 #1
0
        /// <summary>
        /// Function to insert values to Employee Table and returns last identity
        /// </summary>
        /// <param name="employeeinfo"></param>
        /// <returns></returns>
        public decimal EmployeeAddWithReturnIdentity(EmployeeInfo employeeinfo)
        {
            decimal decEmployee = -1;

            try
            {
                decEmployee = SPEmployee.EmployeeAddWithReturnIdentity(employeeinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("EC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decEmployee);
        }
コード例 #2
0
ファイル: frmSalesman.cs プロジェクト: nwelsheimer/NBS
 /// <summary>
 /// Function to save a salesman
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         EmployeeInfo InfoEmployee = new EmployeeInfo();
         EmployeeSP   SpEmployee   = new EmployeeSP();
         InfoEmployee.EmployeeCode    = txtSalesmanCode.Text.Trim();
         InfoEmployee.DesignationId   = Convert.ToDecimal(SpEmployee.SalesmanGetDesignationId());
         InfoEmployee.EmployeeName    = txtName.Text.Trim();
         InfoEmployee.Email           = txtEmail.Text.Trim();
         InfoEmployee.PhoneNumber     = txtPhone.Text.Trim();
         InfoEmployee.MobileNumber    = txtMobile.Text.Trim();
         InfoEmployee.Address         = txtAddress.Text.Trim();
         InfoEmployee.Narration       = txtNarration.Text.Trim();
         InfoEmployee.Dob             = DateTime.Now;
         InfoEmployee.MaritalStatus   = "Single";
         InfoEmployee.Gender          = "Male";
         InfoEmployee.Qualification   = string.Empty;
         InfoEmployee.BloodGroup      = string.Empty;
         InfoEmployee.JoiningDate     = PublicVariables._dtCurrentDate;
         InfoEmployee.TerminationDate = DateTime.Now;
         if (cbxActive.Checked)
         {
             InfoEmployee.IsActive = true;
         }
         else
         {
             InfoEmployee.IsActive = false;
         }
         InfoEmployee.SalaryType           = "Monthly";
         InfoEmployee.DefaultPackageId     = 1;
         InfoEmployee.BankName             = string.Empty;
         InfoEmployee.BankAccountNumber    = string.Empty;
         InfoEmployee.BranchName           = string.Empty;
         InfoEmployee.BranchCode           = string.Empty;
         InfoEmployee.PanNumber            = string.Empty;
         InfoEmployee.PfNumber             = string.Empty;
         InfoEmployee.EsiNumber            = string.Empty;
         InfoEmployee.PassportNo           = string.Empty;
         InfoEmployee.PassportExpiryDate   = DateTime.Now;
         InfoEmployee.VisaNumber           = string.Empty;
         InfoEmployee.VisaExpiryDate       = DateTime.Now;
         InfoEmployee.LabourCardNumber     = string.Empty;
         InfoEmployee.LabourCardExpiryDate = DateTime.Now;
         InfoEmployee.Extra1 = string.Empty;
         InfoEmployee.Extra2 = string.Empty;
         if (SpEmployee.EmployeeCodeCheckExistance(txtSalesmanCode.Text.Trim().ToString(), 0) == false)
         {
             decSalesManId = SpEmployee.EmployeeAddWithReturnIdentity(InfoEmployee);
             Messages.SavedMessage();
             Clear();
             Gridfill();
             if (frmRejectionInObj != null)
             {
                 this.Close();
             }
             if (frmSalesQuotationObj != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.InformationMessage("Salesman code already exist");
             txtSalesmanCode.Focus();
         }
         if (frmSalesReturnObj != null)
         {
             this.Close();
         }
         if (frmSalesOrderObj != null)
         {
             this.Close();
         }
         if (frmSalesInvoiceObj != null)
         {
             this.Close();
         }
         if (frmPOSObj != null)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "S5" + ex.Message;
     }
 }
コード例 #3
0
        public JsonResult SaveEmployee(string employeeId, string strEmployee)
        {
            bool         isSuccess = true;
            string       message   = "success";
            EmployeeInfo info      = new EmployeeInfo();

            try
            {
                EmployeeSP spEmployee            = new EmployeeSP();
                int        nEmployeeId           = int.Parse(employeeId);
                Dictionary <string, object> dict = JsonConvert.DeserializeObject <Dictionary <string, object> >(strEmployee);
                info.EmployeeId   = int.Parse(dict["employeeId"].ToString());
                info.EmployeeCode = dict["employeeCode"] == null ? string.Empty : dict["employeeCode"].ToString();
                info.EmployeeName = dict["employeeName"] == null ? string.Empty : dict["employeeName"].ToString();
                info.SalaryType   = dict["salaryType"] == null ? string.Empty : dict["salaryType"].ToString();
                if (info.SalaryType == "Daily wage")
                {
                    info.DailyWage = decimal.Parse(dict["dailyWage"].ToString());
                }
                else
                {
                    info.DefaultPackageId = int.Parse(dict["salaryPackage"].ToString());
                }
                info.DesignationId        = int.Parse(dict["designationId"].ToString());
                info.Dob                  = Convert.ToDateTime(dict["dob"].ToString());
                info.MaritalStatus        = dict["maritalStatus"] == null ? "Single" : dict["maritalStatus"].ToString();
                info.Gender               = dict["gender"] == null ? "Male" : dict["gender"].ToString();
                info.Qualification        = dict["qualification"] == null ? string.Empty : dict["qualification"].ToString();
                info.BloodGroup           = dict["bloodGroup"] == null ? string.Empty : dict["bloodGroup"].ToString();
                info.JoiningDate          = Convert.ToDateTime(dict["joiningDate"].ToString());
                info.TerminationDate      = Convert.ToDateTime(dict["terminationDate"].ToString());
                info.Address              = dict["address"] == null ? string.Empty : dict["address"].ToString();
                info.PhoneNumber          = dict["phoneNumber"] == null ? string.Empty : dict["phoneNumber"].ToString();
                info.MobileNumber         = dict["mobileNumber"] == null ? string.Empty : dict["mobileNumber"].ToString();
                info.Email                = dict["email"] == null ? string.Empty : dict["email"].ToString();
                info.IsActive             = bool.Parse(dict["isActive"].ToString());
                info.Narration            = dict["narration"] == null ? string.Empty : dict["narration"].ToString();
                info.BankName             = dict["bankName"] == null ? string.Empty : dict["bankName"].ToString();
                info.BankAccountNumber    = dict["bankNumber"] == null ? string.Empty : dict["bankNumber"].ToString();
                info.BranchName           = dict["branchName"] == null ? string.Empty : dict["branchName"].ToString();
                info.BranchCode           = dict["branchCode"] == null ? string.Empty : dict["branchCode"].ToString();
                info.PanNumber            = dict["panNumber"] == null ? string.Empty : dict["panNumber"].ToString();
                info.PfNumber             = dict["pfNumber"] == null ? string.Empty : dict["pfNumber"].ToString();
                info.EsiNumber            = dict["esiNumber"] == null ? string.Empty : dict["esiNumber"].ToString();
                info.PassportNo           = dict["passportNo"] == null ? string.Empty : dict["passportNo"].ToString();
                info.PassportExpiryDate   = Convert.ToDateTime(dict["passportExpiryDate"].ToString());
                info.LabourCardNumber     = dict["labourCardNumber"] == null ? string.Empty : dict["labourCardNumber"].ToString();
                info.LabourCardExpiryDate = Convert.ToDateTime(dict["labourCardExpiryDate"].ToString());
                info.VisaNumber           = dict["visaNumber"] == null ? string.Empty : dict["visaNumber"].ToString();
                info.VisaExpiryDate       = Convert.ToDateTime(dict["visaExpiryDate"].ToString());
                info.ExtraDate            = DateTime.Now;
                info.Extra1               = string.Empty;
                info.Extra2               = string.Empty;
                if (spEmployee.EmployeeCodeCheckExistance(info.EmployeeCode, nEmployeeId) == false)
                {
                    if (nEmployeeId > 0) // edit mode
                    {
                        isSuccess = spEmployee.EmployeeEdit(info);
                    }
                    else //create mode
                    {
                        nEmployeeId = (int)spEmployee.EmployeeAddWithReturnIdentity(info);
                        if (nEmployeeId <= 0)
                        {
                            isSuccess = false;
                            message   = "Can not save this employee with any issues.";
                        }
                    }
                }
                else
                {
                    isSuccess = false;
                    message   = "Employee code already Exist.";
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(Json(new
            {
                isSuccess = isSuccess,
                message = message,
                data = info
            }));
        }