Ejemplo n.º 1
0
 public void Update(KhasaraDetail khasaraDetail)
 {
     DefaultCS defaultC = new DefaultCS();
     try
     {
         KhasaraDetail khasaraNo = (
             from i in defaultC.KhasaraDetails
             where i.Id == khasaraDetail.Id
             select i).First<KhasaraDetail>();
         khasaraNo.KhasaraNo = khasaraDetail.KhasaraNo;
         khasaraNo.KhatauniNo = khasaraDetail.KhatauniNo;
         khasaraNo.OwnerName = khasaraDetail.OwnerName;
         khasaraNo.AreainAcres = khasaraDetail.AreainAcres;
         khasaraNo.BlockId = khasaraDetail.BlockId;
         khasaraNo.VillageId = khasaraDetail.VillageId;
         khasaraNo.AmalDaramadDate = khasaraDetail.AmalDaramadDate;
         khasaraNo.AmalDaramadNo = khasaraDetail.AmalDaramadNo;
         defaultC.SaveChanges();
     }
     finally
     {
         if (defaultC != null)
         {
             ((IDisposable)defaultC).Dispose();
         }
     }
 }
Ejemplo n.º 2
0
 public void Add(KhasaraDetail khasaraDetail)
 {
     DefaultCS defaultC = new DefaultCS();
     try
     {
         defaultC.KhasaraDetails.MergeOption = MergeOption.NoTracking;
         defaultC.KhasaraDetails.AddObject(khasaraDetail);
         defaultC.SaveChanges();
     }
     finally
     {
         if (defaultC != null)
         {
             ((IDisposable)defaultC).Dispose();
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the KhasaraDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToKhasaraDetails(KhasaraDetail khasaraDetail)
 {
     base.AddObject("KhasaraDetails", khasaraDetail);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new KhasaraDetail object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static KhasaraDetail CreateKhasaraDetail(global::System.Int32 id)
 {
     KhasaraDetail khasaraDetail = new KhasaraDetail();
     khasaraDetail.Id = id;
     return khasaraDetail;
 }
Ejemplo n.º 5
0
        protected void ibAdd_Click(object sender, ImageClickEventArgs e)
        {
            IFormatProvider cultureInfo = new CultureInfo("en-GB", true);
            GridViewRow namingContainer = (GridViewRow)((ImageButton)sender).NamingContainer;
            string text = ((TextBox)namingContainer.FindControl("txtKhasaraNoF")).Text;
            string khatauniNo = ((TextBox)namingContainer.FindControl("txtKhatauniNoF")).Text;
            string str = ((TextBox)namingContainer.FindControl("txtOwnerNameF")).Text;
            decimal num = Convert.ToDecimal(((TextBox)namingContainer.FindControl("txtAreainAcresF")).Text);
            int num1 = Convert.ToInt32(base.Request["Code"]);
            int num2 = Convert.ToInt32(base.Request["vCode"]);

            string amalDaramadNo = ((TextBox)namingContainer.FindControl("txtAmalDaramadNoF")).Text;
            string amalDaramadDate = ((TextBox)namingContainer.FindControl("txtAmalDaramadDateF")).Text;

            KhasaraDetail khasaraDetail = new KhasaraDetail()
            {
                BlockId = new int?(num1),
                VillageId = new int?(num2),
                KhasaraNo = text,
                KhatauniNo=khatauniNo,
                OwnerName = str,
                AmalDaramadNo = amalDaramadNo,
                AreainAcres = new decimal?(num)
            };
            if (!string.IsNullOrEmpty(amalDaramadDate))
            {
                khasaraDetail.AmalDaramadDate = new DateTime?(DateTime.Parse(amalDaramadDate, cultureInfo));
            }
            try
            {
                this.kMethods.Add(khasaraDetail);
                this.BindGrid();
                js.ShowAlert(this, "Khasara created succesfully!");
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (!exception.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, exception.Message);
                }
                else
                {
                    js.ShowAlert(this, "Khasara already exists! Please try another name.");
                }
            }
        }
Ejemplo n.º 6
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            IFormatProvider cultureInfo = new CultureInfo("en-GB", true);

            int rowIndex = e.RowIndex;
            string text = ((TextBox)this.GridView1.Rows[rowIndex].FindControl("txtKhasaraNo")).Text;
            string str = ((TextBox)this.GridView1.Rows[rowIndex].FindControl("txtOwnerName")).Text;
            string khatauniNo = ((TextBox)this.GridView1.Rows[rowIndex].FindControl("txtKhatauniNo")).Text;
            string text1 = ((TextBox)this.GridView1.Rows[rowIndex].FindControl("txtAreainAcres")).Text;
            GridViewRow item = this.GridView1.Rows[e.RowIndex];
            HiddenField hiddenField = (HiddenField)item.FindControl("lblId");
            int num = Convert.ToInt32(hiddenField.Value);
            int num1 = Convert.ToInt32(base.Request["Code"]);
            int num2 = Convert.ToInt32(base.Request["vCode"]);

            string amalDaramadNo = ((TextBox)GridView1.Rows[rowIndex].FindControl("txtAmalDaramadNo")).Text;
            string amalDaramadDate = ((TextBox)GridView1.Rows[rowIndex].FindControl("txtAmalDaramadDate")).Text;

            KhasaraDetail khasaraDetail = new KhasaraDetail()
            {
                Id = num,
                BlockId = new int?(num1),
                VillageId = new int?(num2),
                KhasaraNo = text,
                KhatauniNo=khatauniNo,
                OwnerName = str,
                AreainAcres = new decimal?(Convert.ToDecimal(text1)),
                AmalDaramadNo = amalDaramadNo
            };
            if (!string.IsNullOrEmpty(amalDaramadDate))
            {
                khasaraDetail.AmalDaramadDate = new DateTime?(DateTime.Parse(amalDaramadDate, cultureInfo));
            }
            try
            {
                this.kMethods.Update(khasaraDetail);
                this.GridView1.EditIndex = -1;
                this.BindGrid();
                js.ShowAlert(this, "Record updated succesfully!");
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (!exception.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, exception.Message);
                }
                else
                {
                    js.ShowAlert(this, "Khasara already exists! Please try another name.");
                }
            }
        }