Beispiel #1
0
        private void DeleteRM()
        {
            int userId = 0;;

            bool result = false;

            try
            {
                if (Session["CurrentrmVo"] != null)
                {
                    rmVo = (RMVo)Session["CurrentrmVo"];
                }
                else
                {
                    rmVo = (RMVo)Session["rmVo"];
                }
                userId = int.Parse(Session["userId"].ToString());

                if (!string.IsNullOrEmpty(rmVo.BranchList.ToString()))
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry... You need to delete branch associations first');", true);
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRMDetails','none');", true);
                }
                else if (int.Parse(hndRmCustomerCount.Value.ToString()) > 0 || int.Parse(hndBMBranchHead.Value.ToString()) > 0)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Pageloadscript", "alert('Sorry... You need to delete your internal associations first');", true);
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('ViewRMDetails','none');", true);
                }
                else if (string.IsNullOrEmpty(rmVo.BranchList.ToString().Trim()))
                {
                    result = advisorStaffBo.DeleteRM(rmVo.RMId, userId);
                }
                if (result)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('ViewRM','none');", true);
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "EditRMDetails.ascx.cs:btnDelete_Click()");

                object[] objects = new object[2];
                objects[0]   = rmVo;
                objects[1]   = userId;
                objects[2]   = result;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }