Beispiel #1
0
        private void LoadMaterial(string catID, string userID, string matCode, string fromDate, string toDate)
        {
            using (MaterialAdGiverRT receiverTransfer = new MaterialAdGiverRT())
            {
                Int64?categoryID;

                DateTime?fD;
                DateTime?tD;


                if (catID != string.Empty || catID != "")
                {
                    categoryID = Convert.ToInt32(catID);
                }
                else
                {
                    categoryID = null;
                }

                if (matCode == string.Empty || matCode == "")
                {
                    matCode = null;
                }

                if (fromDate != string.Empty || fromDate != "")
                {
                    fD = Convert.ToDateTime(fromDate);
                }
                else
                {
                    fD = null;
                }

                if (toDate != string.Empty || toDate != "")
                {
                    tD = Convert.ToDateTime(toDate);
                }
                else
                {
                    tD = null;
                }

                var matList = receiverTransfer.GetSearchedMaterialsForListView(categoryID, userID, matCode, fD, tD);
                if (matList == null)
                {
                    return;
                }

                using (AdGiverRT adGiverRt = new AdGiverRT())
                {
                    string name = adGiverRt.GetAdGiverIDByEmail(Session["UserName"].ToString()).Name;
                    labelAdCount.Text = " Hi " + name + ", you currently have " + matList.Count + " adverts";
                }

                lvMaterial.DataSource = matList;
                lvMaterial.DataBind();
            }
        }
Beispiel #2
0
 protected void btnDeletePost_Click(object sender, EventArgs e)
 {
     try
     {
         Int64 matId = Convert.ToInt64(Session["adGiverMatIID"]);
         using (MaterialAdGiverRT aMaterialAdminRt = new MaterialAdGiverRT())
         {
             aMaterialAdminRt.DeleteFromMaterialAndPicAndSaveToLog(matId);
             Response.Redirect("~/ManageYourAds.aspx");
         }
     }
     catch (Exception ex)
     {
         labelMessage.Text      = "Error : " + ex.Message;
         labelMessage.ForeColor = System.Drawing.Color.Red;
         labelMessage.Focus();
     }
 }