protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                labelMessageOtherContent.Text = string.Empty;

                using (OtherContentRT receiverTransfer = new OtherContentRT())
                {
                    hdSave.Value = "true";
                    OiiOOther Oiioother = CreateOtherContent();
                    receiverTransfer.AddOtherContent(Oiioother);
                    if (Oiioother.IID > 0)
                    {
                        labelMessageOtherContent.Text      = "Data successfully saved...";
                        labelMessageOtherContent.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessageOtherContent.Text      = "Data not saved...";
                        labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
                    }
                }

                ClearField();
                LoadotherContentListView();
                hdSave.Value = null;
            }
            catch (Exception ex)
            {
                labelMessageOtherContent.Text      = "Error : " + ex.Message;
                labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
            }
        }
 private void FillOtherContentForEdit(OiiOOther oIIoother)
 {
     try
     {
         if (oIIoother != null)
         {
             txtContentTitle.Text       = oIIoother.Title;
             txtShortDiscription.Text   = oIIoother.ShortDescription.ToString();
             txtDetailsDiscription.Text = oIIoother.DetailDescription;
             txtHoldImagePath.Text      = oIIoother.ImageUrl;
             if (oIIoother.IsActive == true)
             {
                 chkOtherContentActv.Checked = true;
             }
             else
             {
                 chkOtherContentActv.Checked = false;
             }
             Session[sessOtherContent] = oIIoother;
         }
     }
     catch (Exception ex)
     {
         labelMessageOtherContent.Text      = "Error : " + ex.Message;
         labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
     }
 }
 protected void lvContent_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "EditContent")
     {
         try
         {
             labelMessageOtherContent.Text = string.Empty;
             btnSave.Visible             = false;
             btnUpdate.Visible           = true;
             btnDelete.Visible           = false;
             btnCancel.Visible           = true;
             chkOtherContentActv.Visible = true;
             int OtherContentID = Convert.ToInt32(e.CommandArgument);
             hdContentID.Value = OtherContentID.ToString();
             using (OtherContentRT receiverTransfer = new OtherContentRT())
             {
                 OiiOOther oIIoother = receiverTransfer.GetOtherContentByIID(OtherContentID);
                 FillOtherContentForEdit(oIIoother);
             }
         }
         catch (Exception ex)
         {
             labelMessageOtherContent.Text      = "Error : " + ex.Message;
             labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
         }
     }
 }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // labelMessage.Text = string.Empty;
                using (OtherContentRT receiverTransfer = new OtherContentRT())
                {
                    hdIsEdit.Value = "true";
                    OiiOOther oiiocontent = CreateOtherContent();

                    if (oiiocontent != null)
                    {
                        receiverTransfer.Updateoiiocontent(oiiocontent);
                        labelMessageOtherContent.Text      = "Data successfully updated...";
                        labelMessageOtherContent.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessageOtherContent.Text      = "Data not updated...";
                        labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
                    }
                }
                ClearField();
                btnVisibilityForCancel();
                LoadotherContentListView();
            }
            catch (Exception ex)
            {
                labelMessageOtherContent.Text      = "Error : " + ex.Message;
                labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemple #5
0
 public void AddOtherContent(OiiOOther Oiioother)
 {
     try
     {
         DatabaseHelper.Insert <OiiOOther>(Oiioother);
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
        private OiiOOther CreateOtherContent()
        {
            Session["UserID"] = "1";
            OiiOOther OiioOther = new OiiOOther();

            try
            {
                if (hdIsEdit.Value == "true")
                {
                    OiioOther.IID = Convert.ToInt32(hdContentID.Value.ToString());
                }
                OiioOther.Title             = txtContentTitle.Text.Trim();
                OiioOther.ShortDescription  = txtShortDiscription.Text.Trim();
                OiioOther.DetailDescription = txtDetailsDiscription.Text.Trim();

                if (txtHoldImagePath.Text == string.Empty && FileUploadImage.HasFile == true)
                {
                    OiioOther.ImageUrl = ImageUpload().ToString();
                }
                else if (txtHoldImagePath.Text != null && FileUploadImage.HasFile == true)
                {
                    OiioOther.ImageUrl = ImageUpload().ToString();
                }
                else
                {
                    OiioOther.ImageUrl = txtHoldImagePath.Text;
                }
                if (OiioOther.IID <= 0)
                {
                    OiioOther.CreatedBy   = Convert.ToInt64(Session["UserID"]);
                    OiioOther.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    OiiOOther Oiioother = (OiiOOther)Session[sessOtherContent];
                    OiioOther.CreatedBy    = Oiioother.CreatedBy;;
                    OiioOther.CreatedDate  = Oiioother.CreatedDate;
                    OiioOther.ModifiedBy   = Convert.ToInt64(Session["UserID"]);
                    OiioOther.ModifiedDate = GlobalRT.GetServerDateTime();
                }
                if ((hdIsEdit.Value == "true" && chkOtherContentActv.Checked == true) || (hdSave.Value == "true" && chkOtherContentActv.Checked != true))
                {
                    OiioOther.IsActive = true;
                }
                else if (hdIsEdit.Value == "true" && chkOtherContentActv.Checked == false)
                {
                    OiioOther.IsActive = false;
                }
            }
            catch (Exception ex)
            {
                labelMessageOtherContent.Text      = "Error : " + ex.Message;
                labelMessageOtherContent.ForeColor = System.Drawing.Color.Red;
            }
            return(OiioOther);
        }
Exemple #7
0
 public OiiOOther GetOtherContentByIID(int OtherContentID)
 {
     try
     {
         OiiOHaatDCDataContext dbContext = DatabaseHelper.GetDataModelDataContext();
         OiiOOther             Oiioother = new OiiOOther();
         Oiioother = dbContext.OiiOOthers.Single(d => d.IID == OtherContentID);
         dbContext.Dispose();
         return(Oiioother);
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
Exemple #8
0
        public void Updateoiiocontent(OiiOOther oiiocontent)
        {
            try
            {
                OiiOHaatDCDataContext msDC = DatabaseHelper.GetDataModelDataContext();

                OiiOOther Oiiocontent = msDC.OiiOOthers.Single(d => d.IID == oiiocontent.IID);
                DatabaseHelper.Update <OiiOOther>(msDC, oiiocontent, Oiiocontent);
                msDC.Dispose();
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }