Beispiel #1
0
    private void updateTRANS(string status)
    {
        if (hfReferenceCode.Value == txtReferenceCode.Text)
        {
            int agnetID = 4;
            if (Session["role"].ToString() == "Agent")
            {
                agnetID = ((AGENT)Session["aGENT"]).AGENTID;
            }
            else if (Session["role"].ToString() == "Location")
            {
                agnetID = (-1) * ((LOCATIONGROUP)Session["lOCATION"]).LOCATIONGROUPID;
            }


            calculateTotal();
            DateTime nullDate = DateTime.Parse(ConfigurationManager.AppSettings["NULL_DATE"].ToString());

            TRANS tRANS = new TRANS();
            tRANS = TRANSManager.GetTRANSByRefCode(txtReferenceCode.Text);
            TRANS tempTRANS = new TRANS();
            tempTRANS.TRANSID = tRANS.TRANSID;

            #region Edit Receiver info
            if (!btnEditReceiver.Visible) //it it invisible that means the Receiver is going to be edited
            {
                txtFirstName.Enabled       = true;
                txtMiddleName.Enabled      = true;
                txtLastName.Enabled        = true;
                txtReceiverCity.Enabled    = true;
                txtReceiverCountry.Enabled = true;

                RECEIVER rECEIVER = new RECEIVER();

                rECEIVER.USERNAME         = User.Identity.Name.ToString();
                rECEIVER.RECEIVERFNAME    = txtFirstName.Text;
                rECEIVER.RECEIVERMNAME    = txtMiddleName.Text;
                rECEIVER.RECEIVERLNAME    = txtLastName.Text;
                rECEIVER.RECEIVERADDRESS1 = "";
                rECEIVER.RECEIVERADDRESS2 = "";
                rECEIVER.RECEIVERCITY     = txtReceiverCity.Text;
                rECEIVER.RECEIVERSTATE    = txtReceiverCountry.Text;
                rECEIVER.RECEIVERZIP      = "";
                rECEIVER.RECEIVERPHONE    = "";
                rECEIVER.SCANURL          = "";
                rECEIVER.CREATEDBY        = int.Parse(Session["userInfoID"].ToString());
                rECEIVER.CREATEDON        = DateTime.Now;
                rECEIVER.UPDATEDBY        = int.Parse(Session["userInfoID"].ToString());
                rECEIVER.UPDATEDON        = DateTime.Now;

                rECEIVER.SCANURL = "~/Uploads/Receiver/no_image.jpeg";

                tRANS.RECEIVERID = RECEIVERManager.InsertRECEIVER(rECEIVER);
                editReceiver(false);
            }
            #endregion

            tempTRANS.CUSTID              = tRANS.CUSTID;
            tempTRANS.RECEIVERID          = tRANS.RECEIVERID;
            tempTRANS.LOCATIONID          = tRANS.LOCATIONID;
            tempTRANS.TRANSDT             = DateTime.Parse(txtDate.Text);
            tempTRANS.TRANSAMOUNT         = Decimal.Parse(txtSendingAmount.Text);
            tempTRANS.TRANSFEES           = Decimal.Parse(txtServiceCharge.Text);
            tempTRANS.TRANSOTHERFEES      = Decimal.Parse(txtOtherServiceCharge.Text);
            tempTRANS.CAUSETRANSOTHERFEES = txtCauseOtherServiceCharges.Text;
            tempTRANS.TRANSPROMOCODE      = txtDiscount.Text;
            tempTRANS.TRANSPROMO          = 0;
            tempTRANS.TRANSTOTALAMOUNT    = Decimal.Parse(txtTotalCharge.Text);
            tempTRANS.FLAG_SM_RECEIVER    = 'N';
            tempTRANS.SM_RECEIVER         = "";
            tempTRANS.FLAG_CALL_RECEIVER  = 'N';
            tempTRANS.RECEIVERPHONENO     = tRANS.RECEIVERPHONENO;
            tempTRANS.FLAG_DD             = 'N';
            tempTRANS.FLAG_TESTQUESTION   = 'N';
            tempTRANS.TESTQUESTION        = txtTestQuestion.Text;
            tempTRANS.TESTANSWER          = txtTestAnswer.Text;
            tempTRANS.FLAG_CALLSENDER     = 'N';
            tempTRANS.FLAG_SMSSENDER      = 'N';
            tempTRANS.FLAG_EMAILSENDER    = 'N';
            tempTRANS.SENDEREMAILADDRESS  = "";
            tempTRANS.TRANSSTATUS         = status != "SAME" ? status : tRANS.TRANSSTATUS;
            tempTRANS.TRANSRECEIVEDID     = "";
            tempTRANS.TRANSRECEIVEDATE    = nullDate;
            tempTRANS.CREATEDBY           = tRANS.CREATEDBY;
            tempTRANS.CREATEDON           = tRANS.CREATEDON;
            tempTRANS.UPDATEDBY           = int.Parse(Session["userInfoID"].ToString()); //agnetID; //for location it will be -ve
            tempTRANS.UPDATEDON           = DateTime.Now;
            tempTRANS.AGENTID             = tRANS.AGENTID;
            tempTRANS.REFCODE             = tRANS.REFCODE;
            bool result = TRANSManager.UpdateTRANS(tempTRANS);

            lblMessage.Text      = "Update Successfully";
            lblMessage.ForeColor = System.Drawing.Color.Green;
            //divEditTrans.Visible = false;
        }
        else
        {
            lblMessage.Text      = "Update Error: You should not change the Ref Code.";
            lblMessage.ForeColor = System.Drawing.Color.Red;
        }
    }