Пример #1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                // labelMessage.Text = string.Empty;
                using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT())
                {
                    hdIsEdit.Value = "true";
                    AdGiverTracing adGiverTracing = CreateadGiverTracing();

                    if (adGiverTracing != null)
                    {
                        receiverTransfer.UpdateadGiverTracing(adGiverTracing);
                        labelMessageUpdateAddGiverTracing.Text      = "Data successfully updated...";
                        labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessageUpdateAddGiverTracing.Text      = "Data not updated...";
                        labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red;
                    }
                }
                ClearField();
                LoadAdGiverTracingUpdate();
            }
            catch (Exception ex)
            {
                labelMessageUpdateAddGiverTracing.Text      = "Error : " + ex.Message;
                labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red;
            }
        }
Пример #2
0
        protected void lvUpdateAdGiver_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "EditUpdateAdGiver")
            {
                try
                {
                    labelMessageUpdateAddGiverTracing.Text = string.Empty;
                    labelVisibility();
                    TextBoxVisibility();
                    panelVisibility();
                    btnUpdate.Visible = true;

                    btnCancel.Visible = true;
                    int AddGiverTracingID = Convert.ToInt32(e.CommandArgument);
                    hdUpdateAdGiverID.Value = AddGiverTracingID.ToString();
                    using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT())
                    {
                        AdGiverTracing adgivrtracing = receiverTransfer.GetAddGiverTracingIID(AddGiverTracingID);
                        FillAddGiverTracingForEdit(adgivrtracing);
                    }
                }
                catch (Exception ex)
                {
                    labelMessageUpdateAddGiverTracing.Text      = "Error : " + ex.Message;
                    labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
Пример #3
0
 private void FillAddGiverTracingForEdit(AdGiverTracing adgivrtracing)
 {
     try
     {
         if (adgivrtracing != null)
         {
             //DropDownTypeID.SelectedValue = usergrp.TypeID.ToString();
             txtUpdateAdGiverID.Text     = adgivrtracing.AdGiverID.ToString();
             txtUpdateMaterialID.Text    = adgivrtracing.MaterialID.ToString();
             txtUpdateIPAddress.Text     = adgivrtracing.IPAddress;
             txtUpdateMACAddress.Text    = adgivrtracing.MACAddress.ToString();
             txtUpdateBrowserNameID.Text = adgivrtracing.BrowserNameID.ToString();
             txtUpdateBrowsingTime.Text  = adgivrtracing.BrowsingTimeDuration.ToString();
             if (adgivrtracing.IsRemoved == true)
             {
                 chkAdgiverTracingActv.Checked = true;
             }
             else
             {
                 chkAdgiverTracingActv.Checked = false;
             }
             Session[sessAddGiverTracing] = adgivrtracing;
         }
     }
     catch (Exception ex)
     {
         labelMessageUpdateAddGiverTracing.Text      = "Error : " + ex.Message;
         labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red;
     }
 }
Пример #4
0
        private AdGiverTracing CreateAdGiverTracing()
        {
            Session["UserID"] = "1";
            AdGiverTracing adGiverTracing = new AdGiverTracing();

            try
            {
                adGiverTracing.AdGiverID            = Convert.ToInt32(txtAdGiverID.Text);
                adGiverTracing.MaterialID           = Convert.ToInt32(txtMaterialID.Text);
                adGiverTracing.IPAddress            = txtIPAddress.Text;
                adGiverTracing.MACAddress           = txtMACAddress.Text;
                adGiverTracing.BrowserNameID        = Convert.ToInt32(txtBrowserID.Text);
                adGiverTracing.BrowsingTimeDuration = txtBrowsingTime.Text;
                if (adGiverTracing.IID <= 0)
                {
                    adGiverTracing.CreatedBy   = Convert.ToInt64(Session["UserID"]);
                    adGiverTracing.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    AdGiverTracing adgivrtracng = (AdGiverTracing)Session[sessAddGiverTracing];
                    adGiverTracing.CreatedBy   = adgivrtracng.CreatedBy;;
                    adGiverTracing.CreatedDate = adgivrtracng.CreatedDate;
                }
            }
            catch (Exception ex)
            {
                labelMessageAddGiverTracing.Text      = "Error : " + ex.Message;
                labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Red;
            }
            return(adGiverTracing);
        }
Пример #5
0
        /// <summary>
        /// method to get Client ip address
        /// </summary>
        /// <param name="GetLan"> set to true if want to get local(LAN) Connected ip address</param>
        /// <returns></returns>
        //public string GetVisitorIPAddress(bool GetLan = false)
        //{
        //    string visitorIPAddress = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

        //    if (String.IsNullOrEmpty(visitorIPAddress))
        //        visitorIPAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

        //    if (string.IsNullOrEmpty(visitorIPAddress))
        //        visitorIPAddress = HttpContext.Current.Request.UserHostAddress;

        //    if (string.IsNullOrEmpty(visitorIPAddress) || visitorIPAddress.Trim() == "::1")
        //    {
        //        GetLan = true;
        //        visitorIPAddress = string.Empty;
        //    }

        //    if (GetLan && string.IsNullOrEmpty(visitorIPAddress))
        //    {
        //        //This is for Local(LAN) Connected ID Address
        //        string stringHostName = Dns.GetHostName();
        //        //Get Ip Host Entry
        //        IPHostEntry ipHostEntries = Dns.GetHostEntry(stringHostName);
        //        //Get Ip Address From The Ip Host Entry Address List
        //        IPAddress[] arrIpAddress = ipHostEntries.AddressList;

        //        try
        //        {
        //            visitorIPAddress = arrIpAddress[arrIpAddress.Length - 2].ToString();
        //        }
        //        catch
        //        {
        //            try
        //            {
        //                visitorIPAddress = arrIpAddress[0].ToString();
        //            }
        //            catch
        //            {
        //                try
        //                {
        //                    arrIpAddress = Dns.GetHostAddresses(stringHostName);
        //                    visitorIPAddress = arrIpAddress[0].ToString();
        //                }
        //                catch
        //                {
        //                    visitorIPAddress = "127.0.0.1";
        //                }
        //            }
        //        }
        //    }
        //    txtIPAddress.Text = visitorIPAddress.ToString();
        //    return visitorIPAddress;


        //}

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                labelMessageAddGiverTracing.Text = string.Empty;
                using (AddGiverTracingRT receiverTransfer = new AddGiverTracingRT())
                {
                    AdGiverTracing addGivrTrc = CreateAdGiverTracing();
                    receiverTransfer.InsertAdGiverTracing(addGivrTrc);
                    if (addGivrTrc.IID > 0)
                    {
                        labelMessageAddGiverTracing.Text      = "Data successfully saved...";
                        labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        labelMessageAddGiverTracing.Text      = "Data not saved...";
                        labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Red;
                    }
                }

                ClearField();
                //LoadUserGrp();
            }
            catch (Exception ex)
            {
                labelMessageAddGiverTracing.Text      = "Error : " + ex.Message;
                labelMessageAddGiverTracing.ForeColor = System.Drawing.Color.Red;
            }
        }
Пример #6
0
 public AdGiverTracing GetAddGiverTracingIID(int AddGiverTracingID)
 {
     try
     {
         OiiOHaatDCDataContext dbContext      = DatabaseHelper.GetDataModelDataContext();
         AdGiverTracing        adGivertracing = new AdGiverTracing();
         adGivertracing = dbContext.AdGiverTracings.Single(d => d.IID == AddGiverTracingID);
         dbContext.Dispose();
         return(adGivertracing);
     }
     catch (Exception ex) { throw new Exception(ex.Message, ex); }
 }
Пример #7
0
        public void UpdateadGiverTracing(AdGiverTracing adGiverTracing)
        {
            try
            {
                OiiOHaatDCDataContext msDC = DatabaseHelper.GetDataModelDataContext();

                AdGiverTracing userGrp = msDC.AdGiverTracings.Single(d => d.IID == adGiverTracing.IID);
                DatabaseHelper.Update <AdGiverTracing>(msDC, adGiverTracing, userGrp);
                msDC.Dispose();
            }
            catch (Exception ex) { throw new Exception(ex.Message, ex); }
        }
Пример #8
0
        private AdGiverTracing CreateadGiverTracing()
        {
            Session["UserID"] = "1";
            AdGiverTracing adGiverTracing = new AdGiverTracing();

            try
            {
                if (hdIsEdit.Value == "true")
                {
                    adGiverTracing.IID = Convert.ToInt32(hdUpdateAdGiverID.Value.ToString());
                }

                adGiverTracing.AdGiverID            = Convert.ToInt32(txtUpdateAdGiverID.Text);
                adGiverTracing.MaterialID           = Convert.ToInt32(txtUpdateMaterialID.Text);
                adGiverTracing.IPAddress            = txtUpdateIPAddress.Text;
                adGiverTracing.MACAddress           = txtUpdateMACAddress.Text;
                adGiverTracing.BrowserNameID        = Convert.ToInt32(txtUpdateBrowserNameID.Text);
                adGiverTracing.BrowsingTimeDuration = txtUpdateBrowsingTime.Text;
                if (adGiverTracing.IID <= 0)
                {
                    adGiverTracing.CreatedBy   = Convert.ToInt64(Session["UserID"]);
                    adGiverTracing.CreatedDate = GlobalRT.GetServerDateTime();
                }
                else
                {
                    AdGiverTracing adgivrtracng = (AdGiverTracing)Session[sessAddGiverTracing];
                    adGiverTracing.CreatedBy   = adgivrtracng.CreatedBy;;
                    adGiverTracing.CreatedDate = adgivrtracng.CreatedDate;
                }
                if ((hdIsEdit.Value != "true" && chkAdgiverTracingActv.Checked != true))
                {
                    adGiverTracing.IsRemoved = false;
                }
                else
                {
                    adGiverTracing.IsRemoved = true;
                }
            }
            catch (Exception ex)
            {
                labelMessageUpdateAddGiverTracing.Text      = "Error : " + ex.Message;
                labelMessageUpdateAddGiverTracing.ForeColor = System.Drawing.Color.Red;
            }
            return(adGiverTracing);
        }