Exemplo n.º 1
0
    protected void btnloaned_Click(object sender, EventArgs e)
    {
        Bill_Sys_BillTransaction_BO n_bo;
        string str = "";

        if (base.Request.QueryString["id"] != null)
        {
            str = base.Request.QueryString["id"].ToString();
        }
        else
        {
            str = "";
        }
        if (this.Session["SelectAll"] != null)
        {
            string str2 = this.Session["OFF_ID"].ToString();
            n_bo = new Bill_Sys_BillTransaction_BO();
            if (n_bo.UpdateStatusAll(this.txtCompanyId.Text, this.txtLoginCompanyId.Text, str2, this.txtSearchBox.Text, "LND", this.txtFlag.Text) >= 1)
            {
                if (str != "2")
                {
                    this.usrMessage.PutMessage("All bills in the current selection with 'Bill Downloaded' status updated successfully to Loaned.");
                }
                else
                {
                    this.usrMessage.PutMessage("Bill Status Updated Succesfully.");
                }
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                this.usrMessage.Show();
                this.BinGrid();
            }
            else
            {
                if (str != "2")
                {
                    this.usrMessage.PutMessage("Error in transaction, only bills with 'Bill Downloaded' status can be changed to Loaned.");
                }
                else
                {
                    this.usrMessage.PutMessage("Error in transaction.");
                }
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage);
                this.usrMessage.Show();
            }
            this.btnSelectAll_Click(null, null);
        }
        else
        {
            ArrayList list = new ArrayList();
            for (int i = 0; i < this.grdBillSearch.Rows.Count; i++)
            {
                CheckBox box = (CheckBox)this.grdBillSearch.Rows[i].FindControl("ChkDelete");
                if (box.Checked)
                {
                    list.Add(this.grdBillSearch.DataKeys[i][1].ToString());
                }
            }
            n_bo = new Bill_Sys_BillTransaction_BO();
            if (n_bo.UpdateStatus(list, this.txtLoginCompanyId.Text, "LND") >= 1)
            {
                if (str != "2")
                {
                    this.usrMessage.PutMessage("All bills in the current selection with 'Bill Downloaded' status updated successfully to Loaned.");
                }
                else
                {
                    this.usrMessage.PutMessage("Bill Status Updated Succesfully.");
                }
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
                this.usrMessage.Show();
                this.grdBillSearch.XGridBindSearch();
            }
            else
            {
                if (str != "2")
                {
                    this.usrMessage.PutMessage("Error in transaction, only bills with 'Bill Downloaded' status can be changed to Loaned.");
                }
                else
                {
                    this.usrMessage.PutMessage("Error in transaction.");
                }
                this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_ErrorMessage);
                this.usrMessage.Show();
            }
        }
    }