Ejemplo n.º 1
0
 protected void btnChngPass_Click(object sender, EventArgs e)
 {
     try
     {
         using (AdGiverRT receiverTransfer = new AdGiverRT())
         {
             string  userEmailId    = Convert.ToString(Session["UserName"]);
             string  password       = txtCurrentPass.Text;
             AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);
             string  UserpassWord   = StringCipher.Decrypt(receiverTransfer.GetPasswordIDByEmail(userEmailId).LoginPassword);
             if (adgiverEmailId != null && UserpassWord == password)
             {
                 using (UserInformationRT receiverTransferuserinfo = new UserInformationRT())
                 {
                     UserInfo UserInfoPassword = CreateUserInfoPassword();
                     receiverTransferuserinfo.UpdateUserInfoPassword(userEmailId, StringCipher.Encrypt(UserInfoPassword.LoginPassword));
                     lblAccountdetails.Text      = "Password successfully updated...";
                     lblAccountdetails.ForeColor = System.Drawing.Color.Green;
                 }
             }
             else
             {
                 lblAccountdetails.Text      = "Current Password is not Valid";
                 lblAccountdetails.ForeColor = System.Drawing.Color.Red;
             }
         }
     }
     catch (Exception ex)
     {
         lblAccountdetails.Text      = "Error : " + ex.Message;
         lblAccountdetails.ForeColor = System.Drawing.Color.Red;
     }
     clearfield();
 }
Ejemplo n.º 2
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            try
            {
                using (AdGiverRT receiverTransfer = new AdGiverRT())
                {
                    string  userEmailId    = Convert.ToString(Session["UserName"]);
                    AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);

                    if (adgiverEmailId != null)
                    {
                        AdGiver adGiverNamePhn = CreateadGiverNamePhn();
                        receiverTransfer.UpdateadGiverAccNamePhn(userEmailId, adGiverNamePhn.Name, adGiverNamePhn.PhoneNo1);
                        lblAccountdetails.Text      = "Name and Phone No. successfully updated...";
                        lblAccountdetails.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        lblAccountdetails.Text      = "Name and Phone No. not updated...";
                        lblAccountdetails.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            catch (Exception ex)
            {
                lblAccountdetails.Text      = "Error : " + ex.Message;
                lblAccountdetails.ForeColor = System.Drawing.Color.Red;
            }
            //clearfield();
            showUserNamePhn();
        }
Ejemplo n.º 3
0
        protected void btnDeactive_Click(object sender, EventArgs e)
        {
            try
            {
                using (AdGiverRT receiverTransfer = new AdGiverRT())
                {
                    string  userEmailId    = Convert.ToString(Session["UserName"]);
                    AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);

                    if (adgiverEmailId != null)
                    {
                        using (UserInformationRT receiverTransferuserinfo = new UserInformationRT())
                        {
                            UserInfo UserDeactive = CreateUserDeactive();
                            receiverTransferuserinfo.UpdateUserDeactive(userEmailId, UserDeactive.Comments, UserDeactive.LeavingCausesID, UserDeactive.IsActiveUser);
                            Session["UserName"] = null;
                            Response.Redirect("~/");
                        }
                    }
                    else
                    {
                        lblAccountdetails.Text      = "Account is not Deactivated Yet";
                        lblAccountdetails.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            catch (Exception ex)
            {
                lblAccountdetails.Text      = "Error : " + ex.Message;
                lblAccountdetails.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 4
0
        private Material CreateMaterial()
        {
            Session["UserID"] = "1";
            Material material = new Material();

            try
            {
                using (MaterialRT receiverTransfer = new MaterialRT())
                {
                    if (hdIsEdit.Value == "true")
                    {
                        material.IID = Convert.ToInt32(hdMaterialID.Value);
                    }
                    material.TitleName = txtTitleName.Text.Trim();
                    using (AdGiverRT adGRt = new AdGiverRT())
                    {
                        var adGiver = !txtUserID.Text.IsNullOrWhiteSpace() ? adGRt.GetAdGiverIDByEmail(txtUserID.Text) : null;

                        material.AdGiverID = adGiver != null ? adGiver.IID : -1;
                    }

                    material.Code         = GetCodeForMaterial();
                    material.Description  = txtDescription.Text.Trim();
                    material.IsFeatured   = chkIsFeatured.Checked;
                    material.IsSpotlight  = chkIsSpotlight.Checked;
                    material.IsUrgent     = chkIsUrgent.Checked;
                    material.LocationID   = Convert.ToInt64(txtLocation.Text);
                    material.CategoryID   = Convert.ToInt32(txtCategory.Text);
                    material.ModelID      = Convert.ToInt64(txtModel.Text);
                    material.BrandID      = Convert.ToInt64(txtModel.Text);
                    material.ColorID      = Convert.ToInt64(txtColor.Text);
                    material.Price        = Convert.ToDecimal(txtPrice.Text);
                    material.TotalVisitor = 0;


                    material.AdDate            = Convert.ToDateTime(txtDate.Text);
                    material.AdDisplayLastDate = Convert.ToDateTime(txtDisplayLastDate.Text);

                    if (material.IID <= 0)
                    {
                        material.CreatedBy   = Convert.ToInt64(Session["UserID"]);
                        material.CreatedDate = GlobalRT.GetServerDateTime();
                    }
                    else
                    {
                        Material mat = (Material)Session[sessMaterial];
                        material.CreatedBy    = mat.CreatedBy;
                        material.CreatedDate  = mat.CreatedDate;
                        material.ModifiedBy   = Convert.ToInt64(Session["UserID"]);
                        material.ModifiedDate = GlobalRT.GetServerDateTime();
                    }
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            return(material);
        }
Ejemplo n.º 5
0
        public AdGiver CreateAdGiver()
        {
            AdGiver adgiver = new AdGiver();

            try
            {
                using (AdGiverRT adGiverRt = new AdGiverRT())
                {
                    bool IsThisEmailAlreadyExist = adGiverRt.GetAdGiverIDByEmail(txtEmail.Text) != null;
                    if (IsThisEmailAlreadyExist)
                    {
                        return(null);
                    }

                    adgiver.Name         = txtAdGiverName.Text;
                    adgiver.ClientTypeID = Convert.ToInt32(dropDownClientType.SelectedValue);
                    adgiver.NationalID   = txtNationalID.Text;
                    adgiver.CompanyOrOrganizationName = txtCompanyName.Text;
                    adgiver.ComOrOrgAddress           = txtCompanyAddress.Text;
                    adgiver.ComOrOrgPhone             = txtCompanyPhoneNo.Text;
                    adgiver.EmailID    = txtEmail.Text;
                    adgiver.PhoneNo1   = txtContactNo.Text;
                    adgiver.PhoneNo2   = txtPhNoOptional.Text;
                    adgiver.LocationID = Convert.ToInt32(txtLocation.Text);
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            return(adgiver);
        }
Ejemplo n.º 6
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();
            }
        }
Ejemplo n.º 7
0
        protected void lvMyfvrt_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteMyfvrt")
            {
                try
                {
                    lblMyfabourite.Text = string.Empty;

                    int MyfabouriteID = Convert.ToInt32(e.CommandArgument);
                    hdmyfvrt.Value = MyfabouriteID.ToString();
                    using (MyFavouriteRT receiverTransfer = new MyFavouriteRT())
                    {
                        receiverTransfer.DeleteMyfabourite(MyfabouriteID);
                        lblMyfabourite.Text      = "Data successfully deleted...";
                        lblMyfabourite.ForeColor = System.Drawing.Color.Green;
                    }
                }
                catch (Exception ex)
                {
                    lblMyfabourite.Text      = "Error : " + ex.Message;
                    lblMyfabourite.ForeColor = System.Drawing.Color.Red;
                }
            }

            else if (e.CommandName == "EditMyfvrt")
            {
                try
                {
                    using (AdGiverRT receiverTransfer = new AdGiverRT())
                    {
                        lblMyfabourite.Text = string.Empty;
                        string  userEmailId    = Convert.ToString(Session["UserName"]);
                        AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);

                        using (MyFavouriteRT receiverTransferMyfvrt = new MyFavouriteRT())
                        {
                            //int MaterialID = Convert.ToInt32(Request.QueryString["ID"]);
                            List <MyFavourite> EmailIDfrmMyfvrt = receiverTransferMyfvrt.GetEmailIDfrmMyfvrt(userEmailId);

                            if (adgiverEmailId.EmailID != null && EmailIDfrmMyfvrt != null && EmailIDfrmMyfvrt.Count > 0)
                            {
                                int         UrlID = Convert.ToInt32(e.CommandArgument);
                                MyFavourite url   = receiverTransferMyfvrt.GetUrlFrmMyfvrt(UrlID);
                                Response.Redirect("DetailPage?option=" + StringCipher.Encrypt(url.MaterialID.ToString()));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    lblMyfabourite.Text      = "Error : " + ex.Message;
                    lblMyfabourite.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
Ejemplo n.º 8
0
        private void LoadAdGiver()
        {
            using (AdGiverRT adGRt = new AdGiverRT())
            {
                string Email   = Session["UserName"].ToString();
                var    adGiver = !txtUserID.Text.IsNullOrWhiteSpace() ? adGRt.GetAdGiverIDByEmail(Email) : null;

                TxtName.Text = adGiver.Name.Trim();

                //  lblAdGiverInfo.Text = "Please select at least one option to be contacted by.";
            }
        }
Ejemplo n.º 9
0
        protected void btnPostAd_Click(object sender, EventArgs e)
        {
            try
            {
                using (MaterialRT receiverTransfer = new MaterialRT())
                {
                    AdGiverRT adGiverRt = new AdGiverRT();
                    string    matCode   = string.Empty;
                    AdGiver   adGiver   = new AdGiver();
                    Material  material  = CreateMaterial();

                    if (material.AdGiverID == -1)
                    {
                        adGiver = CreateAdGiver();
                        if (adGiver != null)
                        {
                            adGiverRt.AddAdGiver(adGiver);
                            material.AdGiverID = adGiverRt.GetAdGiverIDByEmail(adGiver.EmailID).IID;
                            receiverTransfer.AddMaterial(material);
                            matCode = material.Code;
                        }
                    }
                    else
                    {
                        receiverTransfer.AddMaterial(material);
                        matCode = material.Code;
                    }

                    if (material.IID > 0)
                    {
                        labelMessage.Text      = "Your ad successfully posted...and your material code is " + matCode;
                        labelMessage.ForeColor = System.Drawing.Color.Green;
                        ClearField();
                    }
                    else if (adGiver == null)
                    {
                        labelMessage.Text      = "This email already taken...";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                    else
                    {
                        labelMessage.Text      = "Data not saved...";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 10
0
        protected void btnFvrt_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["UserName"] == null)
                {
                    Response.Redirect("~/LoginPage");
                }
                else
                {
                    using (AdGiverRT receiverTransfer = new AdGiverRT())
                    {
                        string  userEmailId    = Convert.ToString(Session["UserName"]);
                        AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);

                        if (adgiverEmailId != null)
                        {
                            using (MyFavouriteRT receiverTransferMyfvrt = new MyFavouriteRT())
                            {
                                int         MaterialID         = Convert.ToInt32(Session["detailID"]);
                                MyFavourite EmailIDnMaterialID = receiverTransferMyfvrt.GetEmailIDnMaterialID(userEmailId, MaterialID);
                                MyFavourite myFvrt             = CreatemyFavrt();
                                if (EmailIDnMaterialID == null)
                                {
                                    receiverTransferMyfvrt.AddMYFvrt(myFvrt);

                                    lblFvrt.Text      = "You Add your Favourite Item Successfully...";
                                    lblFvrt.ForeColor = System.Drawing.Color.DarkSlateBlue;
                                }
                                else
                                {
                                    lblFvrt.Text      = "This Item is already added to your Favourite...";
                                    lblFvrt.ForeColor = System.Drawing.Color.Red;
                                }
                            }
                        }
                        else
                        {
                            lblFvrt.Text      = "Data not Added...";
                            lblFvrt.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblFvrt.Text      = "Error : " + ex.Message;
                lblFvrt.ForeColor = System.Drawing.Color.Red;
            }
        }
Ejemplo n.º 11
0
 private void showUserNamePhn()
 {
     try
     {
         using (AdGiverRT receiverTransfer = new AdGiverRT())
         {
             string  userEmailId    = Convert.ToString(Session["UserName"]);
             AdGiver adgiverEmailId = receiverTransfer.GetAdGiverIDByEmail(userEmailId);
             var     info           = receiverTransfer.GetAdGiverNamePhnByEmail(userEmailId);
             if (adgiverEmailId != null)
             {
                 txtfName.Text = info[0].firstname;
                 txtlName.Text = info[0].lastname;
                 txtpNo.Text   = info[0].PhoneNo1;
             }
         }
     }
     catch (Exception ex)
     {
         lblAccountdetails.Text      = "Error : " + ex.Message;
         lblAccountdetails.ForeColor = System.Drawing.Color.Red;
     }
 }
        //private void LoadClientTypeDropDownInfo()
        //{
        //    try
        //    {
        //        DropDownListHelper.Bind(dropDownClientType, EnumHelper.EnumToList<EnumCollection.ClientType>());
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message, ex);
        //    }
        //}

        public AdGiver CreateAdGiver()
        {
            AdGiver adgiver = new AdGiver();

            try
            {
                using (AdGiverRT adGiverRt = new AdGiverRT())
                {
                    bool IsThisEmailAlreadyExist = adGiverRt.GetAdGiverIDByEmail(txtEmail.Text) != null;
                    if (txtPassword.Text.Length < 6 || IsThisEmailAlreadyExist || (txtPassword.Text != txtConfirmPassword.Text) || txtPassword.Text == string.Empty || txtPassword.Text == "" || txtConfirmPassword.Text == "" || txtConfirmPassword.Text == string.Empty)
                    {
                        return(null);
                    }

                    adgiver.Name         = txtFirstName.Text + " " + txtLastname.Text;
                    adgiver.ClientTypeID = Convert.ToInt32(dropDownClientType.SelectedValue);

                    //if (txtNationalID.Text != "" && txtNationalID.Text != string.Empty)
                    //{
                    //    adgiver.NationalID = txtNationalID.Text;
                    //}

                    if (adgiver.ClientTypeID == Convert.ToInt32(EnumCollection.ClientType.OrganiztionOrCompany))
                    {
                        //adgiver.CompanyOrOrganizationName = txtCompanyName.Text;
                        //adgiver.ComOrOrgAddress = txtCompanyAddress.Text;
                        //adgiver.ComOrOrgPhone = txtCompanyPhoneNo.Text;
                    }

                    adgiver.EmailID  = txtEmail.Text;
                    adgiver.PhoneNo1 = txtContactNo.Text;

                    //if (txtNationalID.Text != "" && txtNationalID.Text != string.Empty)
                    //{
                    //    //adgiver.PhoneNo2 = txtPhNoOptional.Text;
                    //}


                    //if (txtLocationID.Text != "" || txtLocationID.Text != string.Empty)
                    //{
                    //    adgiver.LocationID = Convert.ToInt64(txtLocationID.Text);
                    //}
                    //else
                    //{
                    //try
                    //{
                    //    using (LocationRT aLocationRt = new LocationRT())
                    //    {
                    //        Location aLocation = new Location();
                    //        if (txtLocation.Text != "" || txtLocation.Text != string.Empty)
                    //        {
                    //            aLocation.CurrentLocation = txtLocation.Text;
                    //            aLocation.DistrictID = Convert.ToInt64(txtDistrictID.Text.Trim() != null ? txtDistrictID.Text.Trim() : null);
                    //            aLocation.PoliceStationID = Convert.ToInt64(txtPoliceStationID.Text.Trim() != null ? txtPoliceStationID.Text.Trim() : null);
                    //            aLocation.CountryID = Convert.ToInt32(hdCountryID.Value);
                    //            aLocation.CurrentLocation = txtLocation.Text;
                    //            aLocationRt.AddLocation(aLocation);
                    //            adgiver.LocationID = aLocation.IID;
                    //        }
                    //    }
                    //}
                    //catch (Exception exception)
                    //{
                    //    throw new Exception(exception.Message, exception);
                    //}

                    //}
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            return(adgiver);
        }
Ejemplo n.º 13
0
        private Material CreateMaterial()
        {
            Material material = new Material();

            try
            {
                if (hdIsEdit.Value == "true")
                {
                    material.IID = Convert.ToInt32(hdMaterialID.Value);
                }
                if (string.IsNullOrEmpty(txtLocation.Text.Trim()))
                {
                    labelMessage.Text = "Please enter location";
                    return(null);
                }
                if (string.IsNullOrEmpty(txtDistrict.Text.Trim()) || string.IsNullOrEmpty(txtDistrictID.Text.Trim()))
                {
                    labelMessage.Text = "Please enter district";
                    return(null);
                }
                if (string.IsNullOrEmpty(txtPoliceStation.Text.Trim()) || string.IsNullOrEmpty(txtPoliceStationID.Text.Trim()))
                {
                    labelMessage.Text = "Please enter police station";
                    return(null);
                }

                material.TitleName = txtTitleName.Text.Trim();
                using (AdGiverRT adGRt = new AdGiverRT())
                {
                    var adGiver = !txtUserID.Text.IsNullOrWhiteSpace() ? adGRt.GetAdGiverIDByEmail(txtUserID.Text) : null;
                    material.AdGiverID = adGiver != null ? adGiver.IID : -1;
                }
                material.Code              = txtCode.Text;
                material.Description       = txtDescription.Text.Trim();
                material.IsFeatured        = chkIsFeatured.Checked;
                material.IsSpotlight       = chkIsSpotlight.Checked;
                material.IsUrgent          = chkIsUrgent.Checked;
                material.IsNegotiablePrice = chkNegotiable.Checked;
                material.YoutubeUrl        = txtYoutubeUrl.Text;
                material.WebSiteUrl        = txtWeburl.Text;
                material.UserPhoneNumber   = txtPhoneNumber.Text;
                material.UserEmail         = txtUserID.Text;
                using (LocationRT aLocationRt = new LocationRT())
                {
                    if (txtLocationID.Text != "" || txtLocationID.Text != string.Empty)
                    {
                        var loc = aLocationRt.GetLocationByIID(Convert.ToInt64(txtLocationID.Text));
                        if (txtLocation.Text.ToLower() != loc.CurrentLocation.ToLower())
                        {
                            try
                            {
                                Location aLocation = new Location();
                                if (txtLocation.Text != "" || txtLocation.Text != string.Empty)
                                {
                                    aLocation.CurrentLocation = txtLocation.Text;
                                }
                                aLocation.DistrictID =
                                    Convert.ToInt64(txtDistrictID.Text.Trim() != null ? txtDistrictID.Text.Trim() : null);
                                aLocation.PoliceStationID =
                                    Convert.ToInt64(txtPoliceStationID.Text.Trim() != null
                                        ? txtPoliceStationID.Text.Trim()
                                        : null);
                                aLocation.CountryID       = Convert.ToInt32(hdCountryID.Value);
                                aLocation.CurrentLocation = txtLocation.Text;
                                aLocationRt.AddLocation(aLocation);
                                material.LocationID = aLocation.IID;
                            }
                            catch (Exception exception)
                            {
                                throw new Exception(exception.Message, exception);
                            }
                        }
                        else
                        {
                            material.LocationID = Convert.ToInt64(txtLocationID.Text);
                        }
                    }
                    else
                    {
                        try
                        {
                            Location aLocation = new Location();
                            if (txtLocation.Text != "" || txtLocation.Text != string.Empty)
                            {
                                aLocation.CurrentLocation = txtLocation.Text;
                            }
                            aLocation.DistrictID =
                                Convert.ToInt64(txtDistrictID.Text.Trim() != null ? txtDistrictID.Text.Trim() : null);
                            aLocation.PoliceStationID =
                                Convert.ToInt64(txtPoliceStationID.Text.Trim() != null
                                    ? txtPoliceStationID.Text.Trim()
                                    : null);
                            aLocation.CountryID       = Convert.ToInt32(hdCountryID.Value);
                            aLocation.CurrentLocation = txtLocation.Text;
                            aLocationRt.AddLocation(aLocation);

                            material.LocationID = aLocation.IID;
                        }
                        catch (Exception exception)
                        {
                            throw new Exception(exception.Message, exception);
                        }
                    }
                }

                material.CategoryID = Convert.ToInt32(dropDownCategory.SelectedValue);
                //material.CategoryID = Convert.ToInt32(txtCategoryID.Value);

                if (txtModelID.Text != string.Empty || txtModelID.Text != "")
                {
                    material.ModelID = Convert.ToInt64(txtModelID.Text);
                }
                if (txtBrandID.Text != string.Empty || txtBrandID.Text != "")
                {
                    material.BrandID = Convert.ToInt64(txtBrandID.Text);
                }
                if (txtColorID.Text != string.Empty || txtColorID.Text != "")
                {
                    material.ColorID = Convert.ToInt64(txtColorID.Text);
                }

                material.Price        = Convert.ToDecimal(txtPrice.Text.Trim() != string.Empty ? txtPrice.Text.Trim() : "0");
                material.TotalVisitor = 0;


                material.AdDate = GlobalRT.GetServerDateTime();
                DateTime date = GlobalRT.GetServerDateTime();
                material.AdDisplayLastDate = date.AddDays(Convert.ToDouble(txtPostVisibilityDay.Text.Trim() != string.Empty ? txtPostVisibilityDay.Text.Trim() : "10"));

                if (material.IID <= 0)
                {
                    material.CreatedBy   = Convert.ToInt64(Session["UserID"]);
                    material.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    Material mat = (Material)Session[sessMaterial];
                    material.CreatedBy    = mat.CreatedBy;
                    material.CreatedDate  = mat.CreatedDate;
                    material.ModifiedBy   = Convert.ToInt64(Session["UserID"]);
                    material.ModifiedDate = GlobalRT.GetServerDateTime();
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            return(material);
        }