Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DepositId = Convert.ToInt32(Request["id"]);
            DepositInfomation1.InitDepositInformation(true);

            FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Deposit);

            if (!IsPostBack)
            {
                // new
                if (Request["type"] == "0")
                {
                    // nothing
                }
                else
                {
                    var cDeposit = new CDeposit();
                    var deposit  = cDeposit.Get(DepositId);
                    DepositInfomation1.SetData(deposit);
                    FileDownloadList1.GetFileDownload(deposit.DepositId);
                }
            }
        }
Ejemplo n.º 2
0
        protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "Save":
                if (IsValid)
                {
                    var cDeposit = new CDeposit();
                    Erp2016.Lib.Deposit deposit;
                    // new
                    if (Request["type"] == "0")
                    {
                        deposit = new Erp2016.Lib.Deposit();

                        deposit.SiteLocationId = CurrentSiteLocationId;
                        deposit.CreatedId      = CurrentUserId;
                        deposit.CreatedDate    = DateTime.Now;
                    }
                    // modify
                    else
                    {
                        deposit = cDeposit.Get(DepositId);
                    }

                    deposit.Bank        = DepositInfomation1.GetBank();
                    deposit.Comment     = DepositInfomation1.GetComment();
                    deposit.DepositDate = DepositInfomation1.GetDepositDate();

                    // new
                    if (Request["type"] == "0")
                    {
                        int newIndex = cDeposit.Add(deposit);
                        if (newIndex != -1)
                        {
                            FileDownloadList1.SaveFile(deposit.DepositId);
                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("Error updating");
                        }
                    }
                    // modify
                    else
                    {
                        deposit.UpdatedId   = CurrentUserId;
                        deposit.UpdatedDate = DateTime.Now;
                        if (cDeposit.Update(deposit))
                        {
                            FileDownloadList1.SaveFile(deposit.DepositId);
                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("Error updating");
                        }
                    }
                }
                else
                {
                    ShowMessage("Error can't find deposit");
                }
                break;

            case "Cancel":
                RunClientScript("Close();");
                break;
            }
        }
Ejemplo n.º 3
0
        protected void GetDepositDetail()
        {
            var buttonList = new List <string>();

            buttonList.Add("Add Deposit");
            buttonList.Add("Excel");

            if (RadGridDepositList.SelectedValue != null)
            {
                var cDeposit = new CDeposit();
                var deposit  = cDeposit.Get(Convert.ToInt32(RadGridDepositList.SelectedValue.ToString()));
                DepositInfomation1.SetData(deposit);

                FileDownloadList1.GetFileDownload(Convert.ToInt32(RadGridDepositList.SelectedValue));

                bool isChecked = false;
                switch (deposit.Status)
                {
                // Pending
                case 1:
                    if (CurrentUserId == deposit.CreatedId)
                    {
                        buttonList.Add("Modify Deposit");
                        buttonList.Add("Confirm");
                        buttonList.Add("Cancel");
                        isChecked = true;
                    }
                    break;

                // Created
                case 2:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        buttonList.Add("Confirm");
                    }
                    else
                    {
                        buttonList.Add("Cancel");
                    }
                    break;

                // Confirmed
                case 3:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        buttonList.Add("Cancel");
                    }
                    break;

                // cancel
                default:
                    if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)     //HQ
                    {
                        // nothing
                    }
                    else
                    {
                        buttonList.Add("Confirm");
                        isChecked = true;
                    }
                    break;
                }

                _radGridDepositPayment.ClientSettings.AllowRowsDragDrop  = isChecked;
                RadGridUnDepositPayment.ClientSettings.AllowRowsDragDrop = isChecked;
            }

            foreach (RadToolBarItem item in DepositInfoToolbar.Items)
            {
                if (buttonList.Contains(item.Text))
                {
                    item.Enabled = true;
                }
                else
                {
                    item.Enabled = false;
                }
            }

            _linqDataSourceDepositPayment.WhereParameters.Clear();
            LinqDataSourceUnDepositPayment.WhereParameters.Clear();
            if (RadGridDepositList.SelectedValue != null)
            {
                _linqDataSourceDepositPayment.WhereParameters.Add("DepositId", DbType.Int32, RadGridDepositList.SelectedValue.ToString());
                LinqDataSourceUnDepositPayment.WhereParameters.Add("SiteLocationId", DbType.Int32, CurrentSiteLocationId.ToString());
            }
            else
            {
                _linqDataSourceDepositPayment.WhereParameters.Add("DepositId", DbType.Int32, 0.ToString());
                LinqDataSourceUnDepositPayment.WhereParameters.Add("SiteLocationId", DbType.Int32, 0.ToString());
            }
            _linqDataSourceDepositPayment.Where  = "DepositId == @DepositId";
            LinqDataSourceUnDepositPayment.Where = "SiteLocationId == @SiteLocationId";
        }
Ejemplo n.º 4
0
        protected void DepositInfoToolbar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            if (e.Item.Text == "Confirm" && RadGridDepositList.SelectedValue != null)
            {
                var cDeposit = new CDeposit();
                var deposit  = cDeposit.Get(Convert.ToInt32(RadGridDepositList.SelectedValue.ToString()));

                // HQ
                if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting)
                {
                    deposit.Comment     = DepositInfomation1.GetComment();
                    deposit.Bank        = DepositInfomation1.GetBank();
                    deposit.DepositDate = DepositInfomation1.GetDepositDate();

                    deposit.Status          = 3; // 1:Pending 2:Created, 3:Confirm, 0:Confirm Canceled
                    deposit.HQConfirmUserId = CurrentUserId;
                    deposit.HQConfirmDate   = DateTime.Now;

                    if (cDeposit.Update(deposit))
                    {
                        var cCreaditMemo = new CCreditMemo();
                        cCreaditMemo.ValidateOverPaid(deposit.DepositId, CurrentUserId);

                        RadGridDepositList.Rebind();
                    }
                }
                //schools
                else
                {
                    deposit.Comment     = DepositInfomation1.GetComment();
                    deposit.Bank        = DepositInfomation1.GetBank();
                    deposit.DepositDate = DepositInfomation1.GetDepositDate();

                    deposit.Status = 2; // 1:Pending, 2:Created, 3:Confirm, 0:Confirm Canceled

                    if (cDeposit.Update(deposit))
                    {
                        RadGridDepositList.Rebind();
                    }
                }
            }
            else if (e.Item.Text == "Cancel" && RadGridDepositList.SelectedValue != null)
            {
                var cDeposit = new CDeposit();
                var deposit  = cDeposit.Get(Convert.ToInt32(RadGridDepositList.SelectedValue.ToString()));

                deposit.Comment     = DepositInfomation1.GetComment();
                deposit.Bank        = DepositInfomation1.GetBank();
                deposit.DepositDate = DepositInfomation1.GetDepositDate();

                if (CurrentGroupId == (int)CConstValue.UserGroupForDepositConfirm.Accounting) // HQ
                {
                    deposit.Status = 1;                                                       // 1:Pending, 2:Created, 3:Confirm, 0:Confirm Canceled
                }
                else
                {
                    deposit.Status = 0; // 1:Pending, 2:Created, 3:Confirm, 0:Confirm Canceled
                }
                if (cDeposit.Update(deposit))
                {
                    RadGridDepositList.Rebind();
                }
            }
            else if (e.Item.Text == "Modify Deposit")
            {
                if (RadGridDepositList.SelectedValue != null)
                {
                    RunClientScript("ShowPop('" + RadGridDepositList.SelectedValue + "', '1');");
                }
            }
            else if (e.Item.Text == "Add Deposit")
            {
                RunClientScript("ShowPop('0', '0');");
            }
        }