コード例 #1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (OrgDate == DateTime.MinValue || FileId < 1)
            {
                PageCommon.WriteJs(this, "Invalid parameters!", "parent.CloseTheUpdateExtendWindow();");
                return;
            }

            int extendDays = 0;

            int.TryParse(tbxExtendDays.Text.Trim(), out extendDays);
            if (extendDays < 1)
            {
                PageCommon.WriteJs(this, "Please input the number of days to extend the rate lock!", "parent.CloseTheUpdateExtendWindow();");
                return;
            }
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    var req = new ExtendRateLockRequest
                    {
                        DaysExtended = extendDays,
                        FileId       = FileId,
                        NewDate      = OrgDate.AddDays(extendDays),
                        hdr          = new ReqHdr {
                            UserId = new LoginUser().iUserID
                        }
                    };

                    var response = client.ExtendRateLock(req);
                    if (!response.hdr.Successful)
                    {
                        PageCommon.AlertMsg(this, "Unable to update Point at the moment, reason: " + response.hdr.StatusInfo);
                        //PageCommon.WriteJs(this, "Please input the number of days to extend the rate lock!", "parent.CloseTheUpdateExtendWindow();");
                        return;
                    }
                    else
                    {
                        UpdateTheRateExtendLock(extendDays);
                        return;
                    }
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ee)
            {
                PageCommon.AlertMsg(this, "Failed reason: Point Manager is not running.");
            }
        }