Beispiel #1
0
        private bool DoAdd()
        {
            if (context.li_guarantors.Any(q => q.name == txtGuarantorName.Text.Trim()))
            {
                JscriptMsg("担保机构名称重复!", "", "Error");
                return(false);
            }
            var model = new li_guarantors
            {
                name                  = txtGuarantorName.Text,
                type                  = Convert.ToByte(rblType.SelectedValue),
                regist_number         = txtRegistNumber.Text,
                legal_person          = txtLegalPerson.Text,
                registered_capital    = txtRegisteredCapital.Text,
                setup_time            = Convert.ToDateTime(txtSetupDate.Text),
                address               = txtAddr.Text,
                description           = txtDescription.Text,
                business_scope        = txtBusinessScope.Text,
                shareholders_info     = txtShareholdersInfo.Value,
                credit_situation_info = txtCreditSituationInfo.Value,
                cm_business_types     = txtCMBusinessTypes.Text,
                cm_cooperation_time   = txtCMCooperationTime.Text,
                cm_total_degree       = txtCMCooperationTotalDegree.Text,
                cm_used_degree        = txtCMCooperationUsedDegree.Text,
                cm_remain_degree      = txtCMCooperationRemainDegree.Text,
            };

            context.li_guarantors.InsertOnSubmit(model);
            LoadAlbum(model, Agp2pEnums.AlbumTypeEnum.Pictures);

            try
            {
                context.SubmitChanges();
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加担保机构信息:" + txtGuarantorName.Text); //记录日志
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Beispiel #2
0
 private void LoadAlbum(li_guarantors model, Agp2pEnums.AlbumTypeEnum type)
 {
     string[] albumArr  = Request.Form.GetValues("hid_photo_name");
     string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
     context.li_albums.DeleteAllOnSubmit(context.li_albums.Where(a => a.guarantor == model.id && a.type == (int)type));
     if (albumArr != null)
     {
         var preAdd = albumArr.Zip(remarkArr, (album, remark) =>
         {
             var albumSplit = album.Split('|');
             return(new li_albums
             {
                 original_path = albumSplit[1],
                 thumb_path = albumSplit[2],
                 remark = remark,
                 add_time = DateTime.Now,
                 li_guarantors = model,
                 type = (byte)type
             });
         });
         context.li_albums.InsertAllOnSubmit(preAdd);
     }
 }