Esempio n. 1
0
        public string AddOrg(OrgShort org)
        {
            var result = "Success";
            var qry    = (from orgData in Organization
                          where orgData.parentid == org.parentid &&
                          orgData.organizationname == org.organizationname &&
                          orgData.organizationtypeid == org.organizationtypeid
                          select orgData);

            if (qry.Any())
            {
                return("Duplicate values, Data with same name exists!");
            }


            var item = new Organization();

            item.organizationname   = org.organizationname;
            item.organizationtypeid = org.organizationtypeid;
            item.parentid           = org.parentid;
            item.code         = org.code;
            item.createdby    = org.createdby;
            item.creationtime = DateTime.Now;
            item.isdeleted    = false;
            this.Organization.Add(item);
            this.SaveChanges();
            return(result);
        }
Esempio n. 2
0
        public string UpdateOrg(OrgShort org)
        {
            var result = "Success";
            var qry    = (from orgData in Organization
                          where orgData.parentid == org.parentid &&
                          orgData.organizationname == org.organizationname &&
                          orgData.organizationtypeid == org.organizationtypeid
                          select orgData);

            if (qry.Any())
            {
                return("Duplicate values, Data with same name exists!");
            }
            var item = this.Organization.Where(ob => ob.organizationid == org.organizationid).FirstOrDefault();

            if (item != null)
            {
                item.organizationname = org.organizationname;
                item.modifiedby       = org.createdby;
                item.modifiedtime     = DateTime.Now;
                this.Organization.Update(item);
                this.SaveChanges();
            }
            return(result);
        }
Esempio n. 3
0
        public string DeleteOrg(OrgShort org)
        {
            var inp    = Mapper.Map <DataModels.Organization.OrgShort>(org);
            var result = Repository.DeleteOrg(inp);

            return(result);
        }
Esempio n. 4
0
        public JsonResult DeleteOrg([FromBody] OrgShort value)
        {
            var result = BusinessService.DeleteOrg(value);
            var ret    = $"{{\"msg\":\"{result}\"}}";

            return(new JsonResult(ret));
        }
Esempio n. 5
0
        public string DeleteOrg(OrgShort org)
        {
            string result = "Success";
            string sp = "", query = "", criteria = "";

            sp       = "delorganization";
            criteria = string.Format("{0},{1}", org.organizationid, org.organizationtypeid);
            query    = DbUtility.GetSPName(this.ProviderName, sp, criteria);
            var recs = this.Scaler.FromSql(query);

            result = recs.ToList()[0].delorganization;
            return(result == ""?"Success":result);
        }
Esempio n. 6
0
        public string Update(OrgShort org)
        {
            var input = Mapper.Map <DataModels.Organization.OrgShort>(org);

            return(Repository.UpdateOrg(input));
        }