Exemplo n.º 1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         hdIsDelete.Value  = "true";
         hdIsEdit.Value    = "true";
         labelMessage.Text = string.Empty;
         using (UrlWFListRT reciveTransfer = new UrlWFListRT())
         {
             UrlWFList urlWFList = CreateUrlList();
             List <UserWFPermission> checkIDList = new List <UserWFPermission>();
             checkIDList = reciveTransfer.checkUrlListByID(urlWFList.IID);
             if (checkIDList.Count() > 0)
             {
                 labelMessage.Text      = "Url List " + txtUrlWFName + " Used in UserPermission";
                 labelMessage.ForeColor = System.Drawing.Color.Red;
             }
             else
             {
                 reciveTransfer.DeleteUrl(urlWFList.IID);
                 labelMessage.Text      = "Successfully Deleted!";
                 labelMessage.ForeColor = System.Drawing.Color.Green;
             }
         }
     }
     catch (Exception ex)
     {
         labelMessage.Text      = "Error " + ex.Message;
         labelMessage.ForeColor = System.Drawing.Color.Red;
     }
     LoadUrlWFList();
     ClearField();
     showSaveBtn();
 }
Exemplo n.º 2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            using (UrlWFListRT receiveTransfer = new UrlWFListRT())
            {
                hdIsEdit.Value = "true";
                UrlWFList urlWFList = CreateUrlList();
                List <UserWFPermission> checkIDList = new List <UserWFPermission>();
                checkIDList = receiveTransfer.checkUrlListByID(urlWFList.IID);
                if (checkIDList.Count() > 0)
                {
                    labelMessage.Text      = "Url List " + txtUrlWFName + " Used in UserPermission";
                    labelMessage.ForeColor = System.Drawing.Color.Red;
                    return;
                }


                if (urlWFList != null)
                {
                    receiveTransfer.UpdateUrlWFList(urlWFList);
                    labelMessage.Text      = "Data successfully updated...";
                    labelMessage.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    labelMessage.Text      = "Data not updated...";
                    labelMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            ClearField();
            LoadUrlWFList();
        }
Exemplo n.º 3
0
 protected void lvUrlWFList_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     labelMessage.Text      = "...";
     labelMessage.ForeColor = System.Drawing.Color.Green;
     if (e.CommandName == "EditUrlWFList")
     {
         try
         {
             btnSave.Visible   = false;
             btnCancel.Visible = true;
             btnUpdate.Visible = true;
             btnDelete.Visible = true;
             int urlListID = Convert.ToInt32(e.CommandArgument);
             hdUrlListID.Value = urlListID.ToString();
             using (UrlWFListRT receiverTransfer = new UrlWFListRT())
             {
                 UrlWFList urlWFList = receiverTransfer.GetUrlWFListByID(urlListID);
                 FillUrlWFForEdit(urlWFList);
             }
         }
         catch (Exception ex)
         {
             labelMessage.Text      = "Error : " + ex.Message;
             labelMessage.ForeColor = System.Drawing.Color.Red;
         }
     }
 }
Exemplo n.º 4
0
 public void AddUrlWFList(UrlWFList urlWFList)
 {
     try
     {
         DatabaseHelper.Insert <UrlWFList>(urlWFList);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Exemplo n.º 5
0
        public void UpdateUrlWFList(UrlWFList urlWFList)
        {
            try
            {
                OiiOHaatDCDataContext msDC = DatabaseHelper.GetDataModelDataContext();

                UrlWFList urlWFListNew = msDC.UrlWFLists.Single(d => d.IID == urlWFList.IID);
                DatabaseHelper.Update <UrlWFList>(msDC, urlWFList, urlWFListNew);

                msDC.Dispose();
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }
Exemplo n.º 6
0
 public UrlWFList GetUrlWFListByID(int urlListID)
 {
     try
     {
         OiiOHaatDCDataContext dbContext     = DatabaseHelper.GetDataModelDataContext();
         UrlWFList             urlWFListList = new UrlWFList();
         urlWFListList = dbContext.UrlWFLists.Single(d => d.IID == urlListID);
         dbContext.Dispose();
         return(urlWFListList);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Exemplo n.º 7
0
        //save department
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                using (UrlWFListRT receiveTransfer = new UrlWFListRT())
                {
                    List <UrlWFList> urlListList = new List <UrlWFList>();
                    urlListList = receiveTransfer.GetUrlWFListByNmae(txtUrlWFName.Text.Trim());
                    if (urlListList != null && urlListList.Count() > 0)
                    {
                        string msg = "...Url List already exist...";
                        labelMessage.Text      = msg;
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                        ClearField();
                        return;
                    }

                    UrlWFList urlList = CreateUrlList();
                    receiveTransfer.AddUrlWFList(urlList);

                    if (urlList.IID > 0)
                    {
                        labelMessage.Text      = "Url List Successffuly Inserted";
                        labelMessage.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessage.Text      = "Url did not Inserted";
                        labelMessage.ForeColor = System.Drawing.Color.Red;
                    }
                }
                ClearField();
                LoadUrlWFList();
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemplo n.º 8
0
        private UrlWFList CreateUrlList()
        {
            Session["UserID"] = "1";
            UrlWFList urlWFList = new UrlWFList();

            try
            {
                if (hdIsEdit.Value == "true")
                {
                    urlWFList.IID = Convert.ToInt32(hdUrlListID.Value.ToString());
                }
                urlWFList.UrlWFName        = txtUrlWFName.Text.Trim();
                urlWFList.UrlWFDisplayName = txtUrlWFDisplayName.Text.Trim();
                urlWFList.ModuleName       = dropDownModuleName.SelectedItem.ToString();
                urlWFList.UrlWFSerialNo    = Convert.ToInt32(txtUrlWFSerialNo.Text.Trim());
                urlWFList.ModuleSerialNo   = Convert.ToInt32(txtModuleSerialNo.Text.Trim());
                if (urlWFList.IID <= 0)
                {
                    urlWFList.CreatedBy   = Convert.ToInt32(Session["UserID"]);
                    urlWFList.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    UrlWFList url = (UrlWFList)Session[sessUrlWFList];
                    urlWFList.CreatedBy    = url.CreatedBy;
                    urlWFList.CreatedDate  = url.CreatedDate;
                    urlWFList.ModifiedBy   = url.ModifiedBy;
                    urlWFList.ModifiedDate = url.ModifiedDate;
                }
            }
            catch (Exception e)
            {
                labelMessage.Text      = "Error: " + e.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
            return(urlWFList);
        }
Exemplo n.º 9
0
        protected void FillUrlWFForEdit(UrlWFList urlWFList)
        {
            try
            {
                if (urlWFList != null)
                {
                    txtUrlWFName.Text        = urlWFList.UrlWFName;
                    txtUrlWFDisplayName.Text = urlWFList.UrlWFDisplayName;

                    txtModuleSerialNo.Text = urlWFList.ModuleSerialNo.ToString();
                    txtUrlWFSerialNo.Text  = urlWFList.UrlWFSerialNo.ToString();

                    EnumCollection.ModuleList moduleListEnum = (EnumCollection.ModuleList)Enum.Parse(typeof(EnumCollection.ModuleList), urlWFList.ModuleName);
                    dropDownModuleName.SelectedValue = ((int)moduleListEnum).ToString();

                    Session[sessUrlWFList] = urlWFList;
                }
            }
            catch (Exception ex)
            {
                labelMessage.Text      = "Error : " + ex.Message;
                labelMessage.ForeColor = System.Drawing.Color.Red;
            }
        }