예제 #1
0
        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();
            }
        }
예제 #2
0
        private void LoadData()
        {
            try
            {
                ObjDAL.SetStoreProcedureData("MasterCashClosingID", SqlDbType.Int, pMasterCashClosingID, clsConnection_DAL.ParamType.Input);
                ObjDAL.SetStoreProcedureData("StoreID", SqlDbType.Int, frmHome.Home_StoreID, clsConnection_DAL.ParamType.Input);
                ObjDAL.SetStoreProcedureData("PettyCashBAL", SqlDbType.Decimal, lblPettyCashBAL.Text, clsConnection_DAL.ParamType.Output);
                DataSet ds = ObjDAL.ExecuteStoreProcedure_Get(clsUtility.DBName + ".dbo.SPR_Get_CashClosing_Details");
                if (ds != null && ds.Tables.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    dtCredit   = ds.Tables[1];
                    dtExpenses = ds.Tables[2];

                    DataTable dtoutput = ObjDAL.GetOutputParmData();
                    if (ObjUtil.ValidateTable(dtoutput))
                    {
                        PettyCashBAL         = Convert.ToDecimal(dtoutput.Rows[0][1]);
                        lblPettyCashBAL.Text = PettyCashBAL.ToString();
                    }

                    if (ObjUtil.ValidateTable(dt))
                    {
                        dgvCloseCash.DataSource = dt;
                        dtCash = dt;
                        if (Convert.ToInt32(dt.Rows[0]["CashStatus"]) == 0)
                        {
                            dgvCloseCash.ReadOnly = false;
                            btnOpenCash.Enabled   = false;
                            btnCloseCash.Enabled  = true;
                            btnPreview.Enabled    = false;
                            btnPrint.Enabled      = false;

                            //btnPreview.Enabled = true;
                            //btnPrint.Enabled = true;
                            dgvCloseCash.DataSource = dtCash;
                        }
                        else
                        {
                            if (DateTime.Now.ToString("yyyy-MM-dd") == Convert.ToDateTime(dt.Rows[0]["CashBoxDate"]).ToString("yyyy-MM-dd"))
                            {
                                dgvCloseCash.ReadOnly = true;
                                btnOpenCash.Enabled   = false;
                                btnCloseCash.Enabled  = false;
                                btnPreview.Enabled    = true;
                                btnPrint.Enabled      = true;
                            }
                            else
                            {
                                dgvCloseCash.ReadOnly = true;
                                btnOpenCash.Enabled   = true;
                                btnCloseCash.Enabled  = false;
                                btnPreview.Enabled    = true;
                                btnPrint.Enabled      = true;

                                //btnPreview.Enabled = false;
                                //btnPrint.Enabled = false;
                            }
                        }
                        txtCashNo.Text         = dt.Rows[0]["CashNo"].ToString();
                        txtCashierName.Text    = dt.Rows[0]["Name"].ToString();
                        cmbShop.SelectedValue  = dt.Rows[0]["StoreID"];
                        lblReturnedAmount.Text = dt.Rows[0]["CashReturn"].ToString();
                        txtTotalValue.Text     = dt.Rows[0]["TotalCashValue"].ToString();
                    }
                    else
                    {
                        dgvCloseCash.DataSource = null;
                        dtCash               = null;
                        dtExpenses           = null;
                        btnOpenCash.Enabled  = true;
                        btnCloseCash.Enabled = false;
                        btnPreview.Enabled   = false;
                        btnPrint.Enabled     = false;
                    }
                    ObjDAL.ResetData();
                }
                else
                {
                    dtCash     = null;
                    dtExpenses = null;
                    dgvCloseCash.DataSource = null;
                    //btnOpenCash.Enabled = false;
                    btnOpenCash.Enabled  = true;
                    btnCloseCash.Enabled = false;
                    btnPreview.Enabled   = false;
                    btnPrint.Enabled     = false;
                }
            }
            catch (Exception ex)
            {
                clsUtility.ShowErrorMessage(ex.ToString(), clsUtility.strProjectTitle);
            }
        }