コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLUserGroups((int)MasterCode);

        Label MasterPageTitle = (Label)Master.FindControl("lblTitle");

        MasterPageTitle.Text = BOLClass.PageLable;

        if (MasterCode == null)
        {
            throw new Exception("No MasterCode Exception");
        }
        if (Code == null)
        {
            if (!NewMode)
            {
                return;
            }
        }
        if (!Page.IsPostBack)
        {
            string InstanceName = Request["InstanceName"];
            ViewState["InstanceName"] = InstanceName;

            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLUserLogs((int)MasterCode);

        Label MasterPageTitle = (Label)Master.FindControl("lblTitle");

        MasterPageTitle.Text = BOLClass.PageLable;

        if (MasterCode == null)
        {
            throw new Exception("No MasterCode Exception");
        }
        if (Code == null)
        {
            if (!NewMode)
            {
                return;
            }
        }
        if (!Page.IsPostBack)
        {
            string InstanceName = Request["InstanceName"];
            ViewState["InstanceName"]      = InstanceName;
            cboHCEntityTypeCode.DataSource = new BOLHardCode().GetHCDataTable("HCEntities");
            cboHCUserActionCode.DataSource = new BOLHardCode().GetHCDataTable("HCUserActions");

            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLKeywords();

        hplSysName.Text        = BOLClass.PageLable;
        hplSysName.NavigateUrl = "";//"~/" + BaseID;


        if (Code == null)
        {
            if (!NewMode)
            {
                return;
            }
        }
        if (!Page.IsPostBack)
        {
            string InstanceName = Request["InstanceName"];
            ViewState["InstanceName"] = InstanceName;


            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
コード例 #4
0
ファイル: EditForm.cs プロジェクト: bidaad/ChandSanieh
    protected override void  OnInit(EventArgs e)
    {
        Tools tools = new Tools();

        tools.AccessList = tools.GetAccessList(this.BaseID);
        if (!tools.HasAccess("Edit", this.BaseID))
        {
            Response.Redirect("~/Default.aspx");
        }


        #region Display Mandatory
        Label              lbl;
        string             ctrID, Property, FullPropName;
        string[]           sv = new string[] { };
        ContentPlaceHolder cphMandatory = ((ContentPlaceHolder)((Page)(HttpContext.Current.Handler)).Master.FindControl("cphMain"));
        PropertyInfo       pi, piMandatory;

        Type t;
        if (!BaseID.StartsWith("HC"))
        {
            t = System.Web.Compilation.BuildManager.GetType("BOL" + BaseID, true);
        }
        else
        {
            t = System.Web.Compilation.BuildManager.GetType("BOLHardCode", true);
        }
        IBaseBOL        CurObj = (IBaseBOL)Activator.CreateInstance(t);
        MemberInfo      miMandatory;
        ColumnAttribute attMandatory;
        Type            type = typeof(T).GetType();
        //List<WebControl> listControls = new Tools().GetControls();
        //foreach (WebControl wc in listControls)
        //{
        //    bool IsJASControl = wc.Attributes["jas"] != null;
        //    if (!IsJASControl)
        //        continue;
        //    Property = wc.ID.Substring(3, wc.ID.Length - 3);
        //    ctrID = wc.ID.Substring(3, wc.ID.Length - 3);
        //    pi = type.GetProperty(Property);
        //    lbl = cphMandatory.FindControl("lbl" + ctrID) as Label;

        //    FullPropName = BaseID + "." + Property;
        //    piMandatory = CurObj.GetType().GetProperty(ctrID);
        //    miMandatory = CurObj.GetType().GetMember(ctrID)[0];
        //    attMandatory = (ColumnAttribute)System.Attribute.GetCustomAttribute(miMandatory, typeof(ColumnAttribute));
        //    sv = Tools.SplitValue(attMandatory);
        //    if (sv[2] == "FALSE" && lbl != null)
        //        lbl.Text = "<font style='color:red' title=\"اجباری\"> * </font> " + lbl.Text;
        //}

        #endregion Display Mandatory
        base.OnInit(e);
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!UITools.IsUserSessionStillValid())
        {
            Response.Redirect("~/Admin/Logout.aspx");
        }


        lblFullName.Text = Session["FirstName"] + " " + Session["LastName"];

        string BaseID = Request.QueryString["BaseID"];

        if (!string.IsNullOrEmpty(BaseID))
        {
            IBaseBOL iBOL = UITools.GetBOLClass(BaseID, -1);
            if (iBOL != null)
            {
                lblTitle.Text = iBOL.PageLable;
            }
        }
        else
        {
            lblTitle.Text = AKPSettings.ProjectName;
        }

        HtmlGenericControl script = new HtmlGenericControl("script");

        script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/js/main.js"));
        script.Attributes.Add("type", "text/javascript");
        Page.Header.Controls.Add(script);

        script = new HtmlGenericControl("script");
        script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/js/Browse.js"));
        script.Attributes.Add("type", "text/javascript");
        Page.Header.Controls.Add(script);

        script = new HtmlGenericControl("script");
        script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/js/PersianDate.js"));
        script.Attributes.Add("type", "text/javascript");
        Page.Header.Controls.Add(script);

        script = new HtmlGenericControl("script");
        script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/js/Site.js"));
        script.Attributes.Add("type", "text/javascript");
        Page.Header.Controls.Add(script);

        script = new HtmlGenericControl("script");
        script.Attributes.Add("src", this.ResolveClientUrl("~/Admin/js/farsi.js"));
        script.Attributes.Add("type", "text/javascript");
        Page.Header.Controls.Add(script);
    }
コード例 #6
0
ファイル: EditFormDetail.cs プロジェクト: bidaad/ChandSanieh
    protected virtual void LoadData(int DetailCode)
    {
        Tools tools = new Tools();

        tools.AccessList = tools.GetAccessList(this.BaseID);

        if (!tools.HasAccess("Edit", BaseID) || Request["ViewMode"] == "1")
        {
            ContentPlaceHolder cph     = ((ContentPlaceHolder)((Page)(HttpContext.Current.Handler)).Master.FindControl("cphMain"));
            ImageButton        SaveBtn = (ImageButton)cph.FindControl("imgBtnSave");
            SaveBtn.Visible = false;
        }
        var ObjBaseID = BOLClass.GetDetails(DetailCode);

        if (ObjBaseID != null)
        {
            #region Full Load Data
            #region Automatic Load Data
            Type              t            = System.Web.Compilation.BuildManager.GetType("BOL" + BaseID, true);
            IBaseBOL          CurObj       = (IBaseBOL)Activator.CreateInstance(t, new object[] { (int)MasterCode });
            List <WebControl> listControls = new Tools().GetControls();
            foreach (WebControl wc in listControls)
            {
                string       Property     = wc.ID.Substring(3, wc.ID.Length - 3);
                PropertyInfo pi           = ObjBaseID.GetType().GetProperty(Property);
                string       FullPropName = BaseID + "." + Property;
                #region Cast controls to label if view mode
                //if (!string.IsNullOrEmpty(wc.Attributes["jas"]) && wc.Attributes["jas"] == "1")
                if (Request["ViewMode"] == "1")
                {
                    if (wc is ICustomControlsBase)
                    {
                        ((ICustomControlsBase)wc).DisplayMode = EnmDisplayMode.ViewMode;
                    }
                }
                //else
                //    wc.Enabled = false;

                #endregion
                tools.ShowControl(FullPropName, wc, pi.GetValue(ObjBaseID, new object[] { }), CurObj);
            }
            #endregion
            #endregion
        }
    }
コード例 #7
0
ファイル: EditForm.cs プロジェクト: bidaad/ChandSanieh
    //protected void EditForm_Page_Load(object sender, EventArgs e)
    //{
    //    int aa = 1;
    //}
    protected virtual object LoadData(int DetailCode)
    {
        int HCLevelCode   = 0;
        int DBHCLevelCode = 0;

        if (Session["HCLevelCode"] != null)
        {
            HCLevelCode = Convert.ToInt32(Session["HCLevelCode"]);
        }

        Tools tools = new Tools();

        tools.AccessList = tools.GetAccessList(this.BaseID);
        var ObjBaseID = BOLClass.GetDetails(DetailCode);

        if (ObjBaseID != null)
        {
            #region Full Load Data
            #region Automatic Load Data
            Type     t      = System.Web.Compilation.BuildManager.GetType("BOL" + BaseID, true);
            IBaseBOL CurObj = (IBaseBOL)Activator.CreateInstance(t);

            List <WebControl> listControls = new Tools().GetControls();
            foreach (WebControl wc in listControls)
            {
                string       Property     = wc.ID.Substring(3, wc.ID.Length - 3);
                PropertyInfo pi           = ObjBaseID.GetType().GetProperty(Property);
                string       FullPropName = BaseID + "." + Property;
                if (Property == "HCLevelCode")
                {
                    DBHCLevelCode = Convert.ToInt32(pi.GetValue(ObjBaseID, new object[] { }));
                }
                tools.ShowControl(FullPropName, wc, pi.GetValue(ObjBaseID, new object[] { }), CurObj);
            }
            #endregion
            #endregion
        }
        if (HCLevelCode < DBHCLevelCode)
        {
            Response.Redirect("~/Main/?BaseID=" + BaseID);
        }

        return(ObjBaseID);
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLResources();

        hplSysName.Text        = BOLClass.PageLable;
        hplSysName.NavigateUrl = "~/" + BaseID;


        if (Code == null)
        {
            if (!NewMode)
            {
                return;
            }
        }
        if (!Page.IsPostBack)
        {
            if (!NewMode)
            {
                LoadData((int)Code);
            }
        }
    }
コード例 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BOLClass = new BOLHardCode();

        Label MasterPageTitle = (Label)Master.FindControl("lblTitle");

        //MasterPageTitle.Text = BOLClass.PageLable;

        if (Code == -1)
        {
            return;
        }
        if (!Page.IsPostBack)
        {
            if (NewMode)
            {
            }
            else
            {
                LoadData(BaseID, Code);
            }
        }
    }
コード例 #10
0
ファイル: EditFormDetail.cs プロジェクト: bidaad/ChandSanieh
    void EditFormDetail_Init(object sender, EventArgs e)
    {
        #region Display Mandatory
        Label              lbl;
        string             ctrID, Property, FullPropName;
        string[]           sv = new string[] { };
        ContentPlaceHolder cphMandatory = ((ContentPlaceHolder)((Page)(HttpContext.Current.Handler)).Master.FindControl("cphMain"));
        PropertyInfo       pi, piMandatory;

        Type              t           = System.Web.Compilation.BuildManager.GetType("BOL" + BaseID, true);
        int[]             MasterCodes = { -1 };
        object[]          oArr        = { MasterCodes };
        IBaseBOL          CurObj      = (IBaseBOL)Activator.CreateInstance(t, oArr);
        MemberInfo        miMandatory;
        ColumnAttribute   attMandatory;
        Type              type         = typeof(T).GetType();
        List <WebControl> listControls = new Tools().GetControls();
        foreach (WebControl wc in listControls)
        {
            Property = wc.ID.Substring(3, wc.ID.Length - 3);
            ctrID    = wc.ID.Substring(3, wc.ID.Length - 3);
            pi       = type.GetProperty(Property);
            lbl      = cphMandatory.FindControl("lbl" + ctrID) as Label;

            FullPropName = BaseID + "." + Property;
            piMandatory  = CurObj.GetType().GetProperty(ctrID);
            miMandatory  = CurObj.GetType().GetMember(ctrID)[0];
            attMandatory = (ColumnAttribute)System.Attribute.GetCustomAttribute(miMandatory, typeof(ColumnAttribute));
            sv           = Tools.SplitValue(attMandatory);
            if (sv[2] == "FALSE" && lbl != null)
            {
                lbl.Text = "<font style='color:red' title=\"اجباری\"> * </font> " + lbl.Text;
            }
        }

        #endregion Display Mandatory
    }
コード例 #11
0
ファイル: EditForm.cs プロジェクト: bidaad/ChandSanieh
    protected int SaveControls(string AfterSaveUrl)
    {
        object ReturnValue = -1;

        try
        {
            Type     t      = System.Web.Compilation.BuildManager.GetType("BOL" + BaseID, true);
            IBaseBOL CurObj = (IBaseBOL)Activator.CreateInstance(t);

            #region Full Save Data
            if (!NewMode)
            {
                //CurObj.Code = Convert.ToInt32(Code);vvvv
                PropertyInfo CodeProperty = CurObj.GetType().GetProperty("Code");
                CodeProperty.SetValue(CurObj, Convert.ToInt32(Code), new object[] { });
            }
            #region Automatica Save Data
            List <Dictionary <Control, object> > ObjectList = new List <Dictionary <Control, object> >();
            List <WebControl> listControls = new Tools().GetControls();
            foreach (WebControl wc in listControls)
            {
                Tools.AddToDic(wc, "BOL" + BaseID, ObjectList);
            }
            #endregion
            #region Show Messages and save
            IList messages = Tools.TryGet(ObjectList, CurObj);
            if (messages.Count == 0)
            {
                //messages = CurObj.CheckBusinessRules();
                MethodInfo BusinessRulesMethod = CurObj.GetType().GetMethod("CheckBusinessRules");
                BusinessRulesMethod.Invoke(CurObj, new object[] { });

                if (messages.Count == 0)
                {
                    //CurObj.ObjectList = listControls;vvvvv
                    FieldInfo ObjectListField = CurObj.GetType().GetField("ObjectList");
                    ObjectListField.SetValue(CurObj, listControls);

                    //CurObj.SaveChanges(NewMode);vvvvvv
                    MethodInfo SaveChangesMethod = CurObj.GetType().GetMethod("SaveChanges");
                    ReturnValue = SaveChangesMethod.Invoke(CurObj, new object[] { NewMode });
                }
            }
            if (messages.Count == 0)
            {
                if (NewMode)
                {
                    messages.Add(Messages.ShowMessage(MessagesEnum.PrimaryInfomationSavedSuccessfuly));
                }
                else
                {
                    messages.Add(Messages.ShowMessage(MessagesEnum.SavedSuccessfuly));
                }
            }

            ShowResultMessages(messages, AfterSaveUrl);
            ObjectList.Clear();
            #endregion
            #endregion
        }
        catch (Exception exp)
        {
            //TODO: Handle
            //if (exp.Message == "NotValidFileExtenstion")
            throw (exp);
        }
        return((int)ReturnValue);
    }