private void SaveEmployee()
        {
            ObjDAL.SetStoreProcedureData("EmployeeCode", SqlDbType.NVarChar, txtEmployeeCode.Text.Trim(), clsConnection_DAL.ParamType.Input);
            ObjDAL.SetStoreProcedureData("Name", SqlDbType.NVarChar, txtName.Text.Trim(), clsConnection_DAL.ParamType.Input);
            ObjDAL.SetStoreProcedureData("MobileNo", SqlDbType.VarChar, txtMobileNo.Text, clsConnection_DAL.ParamType.Input);

            if (radMale.Checked)
            {
                ObjDAL.SetStoreProcedureData("Gender", SqlDbType.Bit, true, clsConnection_DAL.ParamType.Input);
            }
            else if (radFemale.Checked)
            {
                ObjDAL.SetStoreProcedureData("Gender", SqlDbType.Bit, false, clsConnection_DAL.ParamType.Input);
            }
            if (dtpDOB.Checked)
            {
                ObjDAL.SetStoreProcedureData("DOB", SqlDbType.DateTime, dtpDOB.Value.ToString("yyyy-MM-dd"), clsConnection_DAL.ParamType.Input);
            }
            else
            {
                ObjDAL.SetStoreProcedureData("DOB", SqlDbType.DateTime, null, clsConnection_DAL.ParamType.Input);
            }
            ObjDAL.SetStoreProcedureData("Address", SqlDbType.NVarChar, txtAdd.Text.Trim(), clsConnection_DAL.ParamType.Input);

            if (PicEmployee.Image != null)
            {
                ObjDAL.SetStoreProcedureData("Photo", SqlDbType.VarBinary, ObjUtil.GetImageBytes(PicEmployee.Image), clsConnection_DAL.ParamType.Input);
            }
            ObjDAL.SetStoreProcedureData("CreatedBy", SqlDbType.Int, clsUtility.LoginID, clsConnection_DAL.ParamType.Input);
            ObjDAL.SetStoreProcedureData("EMPID", SqlDbType.Int, 0, clsConnection_DAL.ParamType.Output);

            bool b = ObjDAL.ExecuteStoreProcedure_DML(clsUtility.DBName + ".dbo.SPR_Insert_Employee");

            if (b)
            {
                DataTable dt = ObjDAL.GetOutputParmData();
                if (ObjUtil.ValidateTable(dt))
                {
                    EmployeeID = Convert.ToInt32(dt.Rows[0][1]);
                }
                ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                clsUtility.ShowInfoMessage("Employee has been added Successfully.", clsUtility.strProjectTitle);

                if (txtUsername.Text.Trim().Length != 0 && txtPass.Text.Trim().Length != 0)
                {
                    CreateNewUser(EmployeeID);
                }
                ClearAll();
                LoadData();
                grpEmployee.Enabled = false;
            }
            else
            {
                clsUtility.ShowInfoMessage("Failed to add the Employee.", clsUtility.strProjectTitle);
                ObjDAL.ResetData();
            }
        }
Exemple #2
0
        private void SaveEmployee()
        {
            ObjDAL.SetColumnData("EmployeeCode", SqlDbType.NVarChar, txtEmployeeCode.Text.Trim());
            ObjDAL.SetColumnData("Name", SqlDbType.NVarChar, txtName.Text.Trim());
            ObjDAL.SetColumnData("ShopID", SqlDbType.Int, cmbShop.SelectedValue);
            if (radMale.Checked)
            {
                ObjDAL.SetColumnData("Gender", SqlDbType.Bit, true);
            }
            else if (radFemale.Checked)
            {
                ObjDAL.SetColumnData("Gender", SqlDbType.Bit, false);
            }
            if (dtpDOB.Checked)
            {
                ObjDAL.SetColumnData("DOB", SqlDbType.DateTime, dtpDOB.Value.ToString("yyyy-MM-dd"));
            }
            else
            {
                ObjDAL.SetColumnData("DOB", SqlDbType.DateTime, DBNull.Value);
            }

            ObjDAL.SetColumnData("Address", SqlDbType.NVarChar, txtAdd.Text.Trim());

            if (PicEmployee.Image != null)
            {
                ObjDAL.SetColumnData("Photo", SqlDbType.VarBinary, ObjUtil.GetImageBytes(PicEmployee.Image));
            }
            ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
            EmployeeID = ObjDAL.InsertData(clsUtility.DBName + ".dbo.EmployeeDetails", true);

            if (EmployeeID > 0)
            {
                //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                clsUtility.ShowInfoMessage("Employee has been added Successfully.", clsUtility.strProjectTitle);

                if (txtUsername.Text.Trim().Length != 0 && txtPass.Text.Trim().Length != 0)
                {
                    CreateNewUser(EmployeeID);
                }
                ClearAll();
                LoadData();
                grpEmployee.Enabled = false;
            }
            else
            {
                clsUtility.ShowInfoMessage("Failed to add the employee.", clsUtility.strProjectTitle);
                ObjDAL.ResetData();
            }
        }
Exemple #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (Validateform())
     {
         if (DuplicateUser(0))
         {
             ObjDAL.SetColumnData("ProductName", SqlDbType.NVarChar, txtProductName.Text.Trim());
             ObjDAL.SetColumnData("CategoryID", SqlDbType.Int, cmbCategory.SelectedValue);
             ObjDAL.SetColumnData("ActiveStatus", SqlDbType.Bit, cmbActiveStatus.SelectedItem.ToString() == "Active" ? 1 : 0);
             ObjDAL.SetColumnData("CreatedBy", SqlDbType.Int, clsUtility.LoginID); //if LoginID=0 then Test Admin else user
             if (PicProductMaster.Image != null)
             {
                 ObjDAL.SetColumnData("Photo", SqlDbType.VarBinary, ObjUtil.GetImageBytes(PicProductMaster.Image));
             }
             if (ObjDAL.InsertData(clsUtility.DBName + ".dbo.ProductMaster", true) > 0)
             {
                 //ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave, clsUtility.IsAdmin);
                 ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterSave);
                 clsUtility.ShowInfoMessage("Product Name : '" + txtProductName.Text + "' is Saved Successfully..", clsUtility.strProjectTitle);
                 ClearAll();
                 LoadData();
                 grpProduct.Enabled = false;
             }
             else
             {
                 clsUtility.ShowInfoMessage("Product Name : '" + txtProductName.Text + "' is not Saved Successfully..", clsUtility.strProjectTitle);
                 ObjDAL.ResetData();
             }
         }
         else
         {
             clsUtility.ShowErrorMessage("'" + txtProductName.Text + "' Product is already exist..", clsUtility.strProjectTitle);
             ObjDAL.ResetData();
             txtProductName.Focus();
         }
     }
 }