Пример #1
0
        public bool SavePettyCashDetails(Attendance.Entities.PettyCashInfo objInfo, int EnteredBy, string Locationname)
        {
            bool success = false;

            try
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["AttendanceConn"].ToString());
                con.Open();
                SqlCommand command = new SqlCommand("[USP_PettycashDetails]", con);
                command.CommandType = CommandType.StoredProcedure;
                //command.Parameters.Add("@EmpID", SqlDbType.VarChar).Value = objInfo.EmpID;
                command.Parameters.Add("@AccountHolderName", SqlDbType.VarChar).Value = objInfo.AccountName;
                command.Parameters.Add("@IncomeType", SqlDbType.VarChar).Value        = objInfo.AmountType;
                command.Parameters.Add("@AcountDate", SqlDbType.DateTime).Value       = objInfo.AccountDate;
                command.Parameters.Add("@BillNo", SqlDbType.VarChar).Value            = objInfo.BillNum;
                command.Parameters.Add("@chequeNo", SqlDbType.VarChar).Value          = objInfo.ChequeNum;
                command.Parameters.Add("@locationname", SqlDbType.VarChar).Value      = Locationname;
                command.Parameters.Add("@EnteredBy", SqlDbType.Int).Value             = EnteredBy;
                command.Parameters.Add("@expenditureAmount", SqlDbType.VarChar).Value = objInfo.ExpenseAmount;
                command.Parameters.Add("@Expdate", SqlDbType.DateTime).Value          = objInfo.ExpenseDate;

                //command.Parameters.Add("@EmpID", SqlDbType.VarChar).Value = objInfo.EmpID;
                command.Parameters.Add("@ServicemanName", SqlDbType.VarChar).Value     = objInfo.ExpenseManName;
                command.Parameters.Add("@expenditureSubtype", SqlDbType.VarChar).Value = objInfo.ExpenseSubType;
                command.Parameters.Add("@expenditureTpe", SqlDbType.VarChar).Value     = objInfo.Expensetype;
                command.Parameters.Add("@FromWhom", SqlDbType.VarChar).Value           = objInfo.FromWhom;
                command.Parameters.Add("@Income", SqlDbType.VarChar).Value             = objInfo.InitialAmoun;
                command.Parameters.Add("@expenditureNotes", SqlDbType.VarChar).Value   = objInfo.Notes;
                command.Parameters.Add("@VoucherNo", SqlDbType.VarChar).Value          = objInfo.VoucherNum;

                command.ExecuteNonQuery();
                con.Close();
                success = true;
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance.Entities.PettyCashInfo objInfo = new Attendance.Entities.PettyCashInfo();
                objInfo.AccountName = txtName.Text==""?"":GeneralFunction.ToProper(txtName.Text);
                objInfo.AmountType = ddlIncomeType.SelectedItem.Text;
                objInfo.AccountDate = txtDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtDate.Text);
                objInfo.InitialAmoun = txtIncome.Text;
                objInfo.FromWhom = txtFrmWhom.Text == "" ? "" : GeneralFunction.ToProper(txtFrmWhom.Text);
                objInfo.ChequeNum = txtChequeNum.Text;
                objInfo.ExpenseAmount = txtExpenseAmnt.Text;
                objInfo.ExpenseDate = txtExpenseDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtExpenseDate.Text);
                objInfo.Expensetype = txtExpenseType.Text;
                objInfo.ExpenseSubType = txtExpenseSubType.Text;
                objInfo.ExpenseManName = txtServiceName.Text == "" ? "" : GeneralFunction.ToProper(txtServiceName.Text);
                objInfo.BillNum = txtBillNum.Text;
                objInfo.VoucherNum = txtVoucherNum.Text;
                objInfo.Notes = txtNotes.Text == "" ? "" : GeneralFunction.ToProperNotes(txtNotes.Text);
                string Locationname = Session["LocationName"].ToString();
                int UserID = Convert.ToInt32(Session["UserID"]);

                Attendance.BAL.Report obj = new Report();
                bool bnew = obj.SavePettyCashDetails(objInfo, UserID, Locationname);

                if (bnew)
                {
                    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Saved successfully..');", true);
                    GetPettyCashDetails();

                }

            }
            catch (Exception ex)
            {

            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance.Entities.PettyCashInfo objInfo = new Attendance.Entities.PettyCashInfo();
                objInfo.AccountName    = txtName.Text == ""?"":GeneralFunction.ToProper(txtName.Text);
                objInfo.AmountType     = ddlIncomeType.SelectedItem.Text;
                objInfo.AccountDate    = txtDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtDate.Text);
                objInfo.InitialAmoun   = txtIncome.Text;
                objInfo.FromWhom       = txtFrmWhom.Text == "" ? "" : GeneralFunction.ToProper(txtFrmWhom.Text);
                objInfo.ChequeNum      = txtChequeNum.Text;
                objInfo.ExpenseAmount  = txtExpenseAmnt.Text;
                objInfo.ExpenseDate    = txtExpenseDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtExpenseDate.Text);
                objInfo.Expensetype    = txtExpenseType.Text;
                objInfo.ExpenseSubType = txtExpenseSubType.Text;
                objInfo.ExpenseManName = txtServiceName.Text == "" ? "" : GeneralFunction.ToProper(txtServiceName.Text);
                objInfo.BillNum        = txtBillNum.Text;
                objInfo.VoucherNum     = txtVoucherNum.Text;
                objInfo.Notes          = txtNotes.Text == "" ? "" : GeneralFunction.ToProperNotes(txtNotes.Text);
                string Locationname = Session["LocationName"].ToString();
                int    UserID       = Convert.ToInt32(Session["UserID"]);


                Attendance.BAL.Report obj = new Report();
                bool bnew = obj.SavePettyCashDetails(objInfo, UserID, Locationname);

                if (bnew)
                {
                    System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Saved successfully..');", true);
                    GetPettyCashDetails();
                }
            }
            catch (Exception ex)
            {
            }
        }