Beispiel #1
0
 public Int64? InsertArea1(ForestArea forestArea, CadastralPoint[] cadastralPoints)
 {
     using (var db = new DefaultCS())
     {
         try
         {
             if (cadastralPoints != null)
             {
                 EntityCollection<CadastralPoint> cp = new EntityCollection<CadastralPoint>();
                 foreach (var cpp in cadastralPoints)
                 {
                     cp.Add(cpp);
                 }
                 forestArea.CadastralPoints1 = cp;
             }
             forestArea.CreatedDate = DateTime.Now;
             db.ForestAreas.AddObject(forestArea);
             db.SaveChanges();
             return forestArea.Id;
         }
         catch (Exception ex)
         {
             return null;
         }
     }
 }
Beispiel #2
0
 public static Int64 InsertArea(ForestArea forestArea)
 {
     using (var db = new DefaultCS())
     {
         db.ForestAreas.AddObject(forestArea);
         db.SaveChanges();
     }
     return forestArea.Id;
 }
Beispiel #3
0
        public Int64? UpdateArea(ForestArea forestArea, ForestCoordinate[] forestCoordinates)
        {
            IFormatProvider provider = new System.Globalization.CultureInfo("en-GB", true);

            using (var db = new DefaultCS())
            {
                try
                {
                    var fUpdate = db.ForestAreas.Where(i => i.Id == forestArea.Id).First();

                    foreach (var fcc in forestCoordinates)
                    {
                        var forestC = db.ForestCoordinates.Where(i => i.Id == fcc.Id).First();
                        forestC.BackBearings = fcc.BackBearings;
                        forestC.BackDistanceInChain = fcc.BackDistanceInChain;
                        forestC.BackDistanceInMeter = fcc.BackDistanceInMeter;
                        forestC.BearingDifference = fcc.BearingDifference;
                        forestC.ForwardBearings = fcc.ForwardBearings;
                        forestC.Latitude = fcc.Latitude;
                        forestC.Longitude = fcc.Longitude;
                        forestC.PillarNo = fcc.PillarNo;
                        forestC.LatitudeField = fcc.LatitudeField;
                        forestC.LongitudeField = fcc.LongitudeField;
                    }
                    fUpdate.AreaInField = forestArea.AreaInField;
                    fUpdate.AreaCalculated = forestArea.AreaCalculated;
                    fUpdate.AreaInGazette = forestArea.AreaInGazette;
                    fUpdate.BlockId = forestArea.BlockId;
                    fUpdate.ForestName = forestArea.ForestName;
                    fUpdate.ForestType = forestArea.ForestType;
                    fUpdate.GazetteNo = forestArea.GazetteNo;
                    fUpdate.isReferencePoint = forestArea.isReferencePoint;
                    fUpdate.NumberOfPillars = forestArea.NumberOfPillars;
                    fUpdate.VillageId = forestArea.VillageId;

                    //fUpdate.GazetteDate = DateTime.Parse(forestArea.GazetteDate.ToString(), provider);
                    fUpdate.GazetteDate = forestArea.GazetteDate;
                    fUpdate.UpdatedDate = DateTime.Now;
                    fUpdate.UpdatedBy = forestArea.UpdatedBy;

                    db.SaveChanges();
                    return forestArea.Id;
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
        }
Beispiel #4
0
        public void Update(ForestArea forestArea, EntityCollection<GazetteDetail> gd)
        {
            IFormatProvider provider = new System.Globalization.CultureInfo("en-GB", true);

            using (var db = new DefaultCS())
            {
                try
                {
                    var fUpdate = db.ForestAreas.Where(i => i.Id == forestArea.Id).First();

                    var arrGD = db.GazetteDetails.Where(i => i.ForestAreaId == forestArea.Id).ToList();

                    if (arrGD.Count > 0)
                    {
                        arrGD.ForEach(i => { db.GazetteDetails.DeleteObject(i); });
                    }

                    foreach (var fcc in gd)
                    {
                        db.GazetteDetails.AddObject(fcc);
                    }
                    fUpdate.NotificationNo = forestArea.NotificationNo;
                    fUpdate.NotificationType = forestArea.NotificationType;
                    fUpdate.GazetteAuthority = forestArea.GazetteAuthority;
                    fUpdate.GazetteNo = forestArea.GazetteNo;

                    fUpdate.GazetteTitle = forestArea.GazetteTitle;
                    fUpdate.PagesInEnglish = forestArea.PagesInEnglish;
                    fUpdate.PagesInHindi = forestArea.PagesInHindi;

                    fUpdate.GazetteDate = forestArea.GazetteDate;

                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #5
0
 public Int64? InsertArea(ForestArea forestArea, ForestCoordinate[] forestCoordinates)
 {
     using (var db = new DefaultCS())
     {
         try
         {
             EntityCollection<ForestCoordinate> fc = new EntityCollection<ForestCoordinate>();
             foreach (var fcc in forestCoordinates)
             {
                 fc.Add(fcc);
             }
             forestArea.ForestCoordinates = fc;
             forestArea.CreatedDate = DateTime.Now;
             db.ForestAreas.AddObject(forestArea);
             db.SaveChanges();
             return forestArea.Id;
         }
         catch (Exception ex)
         {
             return null;
         }
     }
 }
Beispiel #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ForestAreas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToForestAreas(ForestArea forestArea)
 {
     base.AddObject("ForestAreas", forestArea);
 }
Beispiel #7
0
 /// <summary>
 /// Create a new ForestArea object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static ForestArea CreateForestArea(global::System.Int64 id)
 {
     ForestArea forestArea = new ForestArea();
     forestArea.Id = id;
     return forestArea;
 }
Beispiel #8
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     IFormatProvider cultureInfo = new CultureInfo("en-GB", true);
     long num = Convert.ToInt64(base.Server.HtmlEncode(base.Request.QueryString["Code"]));
     ForestArea forestArea = new ForestArea()
     {
         Id = num,
         NotificationNo = this.txtNotificationNumber.Text.Trim(),
         NotificationType = this.txtNotificationType.Text.Trim()
     };
     if (this.txtGazetteDate.Text.Trim() != "")
     {
         forestArea.GazetteDate = new DateTime?(DateTime.Parse(this.txtGazetteDate.Text.Trim(), cultureInfo));
     }
     forestArea.GazetteNo = this.txtGazetteNo.Text.Trim();
     forestArea.GazetteAuthority = this.txtGazetteAuthority.Text.Trim();
     forestArea.GazetteTitle = this.txtGazetteTitle.Text.Trim();
     if (this.txtEnglishPage.Text.Trim() != "")
     {
         forestArea.PagesInEnglish = new int?(Convert.ToInt32(this.txtEnglishPage.Text.Trim()));
     }
     if (this.txtHindiPage.Text.Trim() != "")
     {
         forestArea.PagesInHindi = new int?(Convert.ToInt32(this.txtHindiPage.Text.Trim()));
     }
     EntityCollection<GazetteDetail> gazetteDetails = new EntityCollection<GazetteDetail>();
     foreach (GridViewRow row in this.gvShow.Rows)
     {
         HiddenField hiddenField = (HiddenField)row.FindControl("hfLanguage");
         HiddenField hiddenField1 = (HiddenField)row.FindControl("hfPhoto");
         TextBox textBox = (TextBox)row.FindControl("txtPageNumber");
         FileUpload fileUpload = (FileUpload)row.FindControl("fuImage");
         GazetteDetail gazetteDetail = new GazetteDetail()
         {
             ForestAreaId = num,
             Language = hiddenField.Value
         };
         if (textBox.Text.Trim() != "")
         {
             gazetteDetail.PageNo = new int?(Convert.ToInt32(textBox.Text.Trim()));
         }
         if (hiddenField1.Value != "")
         {
             gazetteDetail.Photo = hiddenField1.Value;
         }
         if (fileUpload.HasFile)
         {
             gazetteDetail.Photo = fileUpload.PostedFile.FileName;
             string str = string.Concat(base.Server.MapPath("~"), "\\MAP\\", fileUpload.FileName);
             HttpPostedFile postedFile = fileUpload.PostedFile;
             if (postedFile.ContentLength > 0)
             {
                 ResizeIamge.ResizeFromStream(str, 800, postedFile.InputStream);
             }
         }
         gazetteDetails.Add(gazetteDetail);
     }
     this.fMethods.Update(forestArea, gazetteDetails);
     js.ShowAlert(this, "Gazette details updated sucessfully!");
 }
Beispiel #9
0
        public Int64? UpdateArea1(ForestArea forestArea, CadastralPoint[] cadastralPoints)
        {
            IFormatProvider provider = new System.Globalization.CultureInfo("en-GB", true);

            using (var db = new DefaultCS())
            {
                try
                {
                    var fUpdate = db.ForestAreas.Where(i => i.Id == forestArea.Id).First();

                    if (cadastralPoints != null)
                    {
                        foreach (var cpp in cadastralPoints)
                        {
                            try
                            {
                                var CC = db.CadastralPoints.Where(i => i.ForestAreaId == fUpdate.Id);
                                foreach (CadastralPoint ccc in CC)
                                {
                                    db.CadastralPoints.DeleteObject(ccc);
                                }
                            }
                            catch (Exception) { }
                            cpp.ForestAreaId = fUpdate.Id;
                            db.CadastralPoints.AddObject(cpp);
                        }
                    }

                    fUpdate.AreaInGazette = forestArea.AreaInGazette;
                    fUpdate.BlockId = forestArea.BlockId;
                    fUpdate.ForestName = forestArea.ForestName;
                    fUpdate.ForestType = forestArea.ForestType;
                    fUpdate.GazetteNo = forestArea.GazetteNo;
                    fUpdate.CadastralPoints = forestArea.CadastralPoints;
                    fUpdate.VillageId = forestArea.VillageId;

                    //fUpdate.GazetteDate = DateTime.Parse(forestArea.GazetteDate.ToString(), provider);
                    fUpdate.GazetteDate = forestArea.GazetteDate;
                    fUpdate.UpdatedDate = DateTime.Now;
                    fUpdate.UpdatedBy = forestArea.UpdatedBy;

                    db.SaveChanges();
                    return forestArea.Id;
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
        }