protected void Page_Load(object sender, EventArgs e)
    {
        Int64 id = 0;

        if (!string.IsNullOrEmpty(Request["id"]))
        {
            id = Convert.ToInt64(Request["id"]);
        }
        if (id > 0)
        {
            UO = BO_Main_AdvertisementsType.GetObjectById(id);
        }
        if (UO == null)
        {
            UO = new DO_Main_AdvertisementsType.UO_Main_AdvertisementsType();
        }

        if (Request.Form.Keys.Count > 0)
        {
            GetTogether.Web.WebHelper.SetValues <DO_Main_AdvertisementsType.UO_Main_AdvertisementsType>(UO, "Main_AdvertisementsType_");
            if (id > 0)
            {
                //Pending
                UO["UpdateOn", "yyyy-MM-dd"] = DateTime.Now.ToString("yyyy-MM-dd");
                UO["UpdateBy"] = string.Concat("WS-", Request.UserHostAddress);
                UO.Update(BO_Main_AdvertisementsType.GetConditionsById(id));
            }
            else
            {
                //Pending
                UO["CreateOn", "yyyy-MM-dd"] = DateTime.Now.ToString("yyyy-MM-dd");
                UO["CreateBy"] = string.Concat("WS-", Request.UserHostAddress);
                UO.Insert();
            }
            Response.Redirect("Main_AdvertisementsType.aspx");
        }
    }
Example #2
0
    private void GetList()
    {
        Database_Output_Main_AdvertisementsType_Result c = (Database_Output_Main_AdvertisementsType_Result)Page.LoadControl("Main_AdvertisementsType_Result.ascx");

        DO_Main_AdvertisementsType.UO_Main_AdvertisementsType l = new DO_Main_AdvertisementsType.UO_Main_AdvertisementsType();
        GetTogether.Web.WebHelper.SetValues <DO_Main_AdvertisementsType.UO_Main_AdvertisementsType>(l, "Main_AdvertisementsType_");
        if (string.IsNullOrEmpty(Sort))
        {
            Sort = DO_Main_AdvertisementsType.Columns.Id.ToString();
        }
        PagingResult <DO_Main_AdvertisementsType.UO_Main_AdvertisementsType, DO_Main_AdvertisementsType.UOList_Main_AdvertisementsType> resultPaging = BO_Main_AdvertisementsType.GetPagingList(l, PageIndex, PageSize, Sort, IsAsc);

        c.JsFunction = "Main_AdvertisementsType_Search";
        c.SetData <DO_Main_AdvertisementsType.UO_Main_AdvertisementsType, DO_Main_AdvertisementsType.UOList_Main_AdvertisementsType>(resultPaging.Result);
        c.Total     = resultPaging.Total;
        c.Sort      = Sort;
        c.PageIndex = PageIndex;
        c.PageSize  = PageSize;
        c.IsAsc     = IsAsc;
        this.Controls.Add(c);
    }