示例#1
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;
            }
        }
示例#2
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');");
            }
        }