Beispiel #1
0
 public bool SaveGeneralInfo(Model.Organization organization)
 {
     try
     {
         InfoBL.saveGeneralInfo(organization);
         return(true);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public int AddOrganization(Organization model)
 {
     string cmdText = @"INSERT INTO [Organization]  ([Agency],[ParentId],[Sort],[Person],[Remark])  values (@Agency,@ParentId,@Sort,@Person,@Remark) ";
     SqlParameter[] parameters =
     {
         SqlParamHelper.MakeInParam("@Agency",SqlDbType.VarChar,50,model.Agency),
         SqlParamHelper.MakeInParam("@ParentId",SqlDbType.Int,4,model.ParentId),
         SqlParamHelper.MakeInParam("@Sort",SqlDbType.Int,4,model.Sort),
         SqlParamHelper.MakeInParam("@Person",SqlDbType.VarChar,10,model.Person),
         SqlParamHelper.MakeInParam("@Remark",SqlDbType.VarChar,50,model.Remark)
     };
     return SqlHelper.ExecuteNonQuery(WriteConnectionString,CommandType.Text,cmdText,parameters);
 }
 public void CreateOrganization(Model.Organization organization)
 {
     _organizations.Add(organization);
 }
Beispiel #4
0
 public int UpdateOrganization(Organization model)
 {
     return _OrganizationRepository.UpdateOrganization(model);
 }
Beispiel #5
0
 public int AddOrganization(Organization model)
 {
     return _OrganizationRepository.AddOrganization(model);
 }
 public int UpdateOrganization(Organization model)
 {
     string cmdText = @"Update [Organization]  set [Agency]=@Agency,[ParentId]=@ParentId,[Sort]=@Sort,[Person]=@Person,[Remark]=@Remark where Id=@Id";
     SqlParameter[] parameters =
     {
         SqlParamHelper.MakeInParam("@Id",SqlDbType.Int,4,model.Id),
         SqlParamHelper.MakeInParam("@Agency",SqlDbType.VarChar,50,model.Agency),
         SqlParamHelper.MakeInParam("@ParentId",SqlDbType.Int,4,model.ParentId),
         SqlParamHelper.MakeInParam("@Sort",SqlDbType.Int,4,model.Sort),
         SqlParamHelper.MakeInParam("@Person",SqlDbType.VarChar,10,model.Person),
         SqlParamHelper.MakeInParam("@Remark",SqlDbType.VarChar,50,model.Remark)
     };
     return SqlHelper.ExecuteNonQuery(WriteConnectionString,CommandType.Text,cmdText,parameters);
 }
Beispiel #7
0
 public void CreateOrganization(Organization organization)
 {
     db.Organizations.Add(organization);
 }
        private void SaveOrg()
        {
            Organization model = null;
            string name = GetRequestString("name");
            string remark = GetRequestString("remark");
            string person = GetRequestString("person");
            int sort = GetRequestString("sort").ToInt32();
            int parent = GetRequestString("parentId").ToInt32(0);

            List<Organization> list = _OrganizationService.GetOrganizationsByPid(parent);
            List<string> listSql = new List<string>();
            if(!GetRequestString("Id").IsNullOrEmpty()){
                int Id = GetRequestString("Id").ToInt32();
                model = _OrganizationService.GetOrganization(Id);
                if(model.ParentId == parent){
                    if(sort > list.Count){
                        sort = list.Count;
                    }
                    if(model.Sort > sort){
                        _OrganizationService.UpdateParentSortUp(parent,sort,model.Sort);
                    }
                    else if(model.Sort < sort){
                        _OrganizationService.UpdateParentSortDown(parent,sort,model.Sort);
                    }
                }
                else{
                    if(sort > list.Count + 1){
                        sort = list.Count + 1;
                    }
                    else{
                        _OrganizationService.UpdateChildSortUp(parent,sort);
                        _OrganizationService.UpdateChildSortDown(model.ParentId,model.Sort);
                    }
                }
                model.Agency = name;
                model.Person = person;
                model.Remark = remark;
                model.Sort = sort;
                model.ParentId = parent;
                _OrganizationService.UpdateOrganization(model);
            }
            else{
                model = new Organization();
                model.Agency = name;
                model.Person = person;
                model.Remark = remark;
                if(sort > list.Count + 1){
                    sort = list.Count + 1;
                }
                else{
                    _OrganizationService.UpdateChildSortUp(parent,sort);
                    _OrganizationService.UpdateChildSortDown(model.ParentId,model.Sort);
                }
                model.Sort = sort;
                model.ParentId = parent;
                _OrganizationService.AddOrganization(model);
            }

            Response.Write("true");
        }