예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void StoreFamilyRelationship_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
 {
     if (!string.IsNullOrEmpty(hdfPrKeyHoSo.Text))
     {
         storeFamilyRelationship.DataSource = FamilyRelationshipController.GetAll(Convert.ToInt32(hdfPrKeyHoSo.Text));
         storeFamilyRelationship.DataBind();
     }
 }
예제 #2
0
 /// <summary>
 /// Save DB
 /// </summary>
 /// <param name="json"></param>
 /// <param name="recordId"></param>
 private void SaveGridFamilyRelationship(string json, int recordId)
 {
     if (!string.IsNullOrEmpty(json))
     {
         var controller = new FamilyRelationshipController();
         var rs         = Ext.Net.JSON.Deserialize <List <FamilyRelationshipModel> >(json);
         foreach (var item in rs)
         {
             var obj = new hr_FamilyRelationship
             {
                 Id             = item.Id,
                 FullName       = item.FullName,
                 BirthYear      = item.BirthYear,
                 Sex            = item.Sex,
                 RelationshipId = item.RelationshipId,
                 Occupation     = item.Occupation,
                 WorkPlace      = item.WorkPlace,
                 Note           = item.Note,
                 IsDependent    = item.IsDependent,
                 IDNumber       = item.IDNumber,
                 CreatedDate    = DateTime.Now,
                 EditedDate     = DateTime.Now,
             };
             if (!string.IsNullOrEmpty(item.SexName) && item.SexName == "M")
             {
                 obj.Sex = true;
             }
             else
             {
                 obj.Sex = false;
             }
             obj.RecordId = recordId;
             if (obj.Id > 0)
             {
                 controller.Update(obj);
                 storeFamilyRelationship.CommitChanges();
             }
             else
             {
                 controller.Insert(obj);
                 storeFamilyRelationship.DataSource = FamilyRelationshipController.GetAll(recordId);
                 storeFamilyRelationship.DataBind();
                 storeFamilyRelationship.CommitChanges();
             }
         }
         GridPanelFamilyRelationship.Reload();
     }
 }