Example #1
0
        //        private string Get_DeleteBy()
        //        {
        //            if (LstInfoTable.Count(q => q.isKey) < 2) return string.Empty;
        //            var lstKey = LstInfoTable.Where(q => q.isKey).ToList();
        //            string param = null;
        //            string value = null;
        //            string result = "";
        //            foreach (var item in lstKey)
        //            {
        //                value = item.Name;
        //                param = $"{item.GetTypeCs()} {item.Name}";
        //                result += $@"
        //public bool {GetNameMethod(eMethod.DeleteBy)}{item.Name}({param})
        //{'{'}
        //    return new {cDal}().{GetNameMethod(eMethod.DeleteBy)}{item.Name}({value});
        //{'}'}
        //";
        //            }
        //            return result;
        //        }

        private string Get_Update()
        {
            if (!LstInfoTable.Any(q => q.IsPK) || LstInfoTable.Count == LstInfoTable.Count(q => q.IsPK))
            {
                return(string.Empty);
            }
            return($@"
public int Update({cDto} ob)
{'{'}
    return new {cDal}().{GetNameMethod(eMethod.Update)}(ob);
{'}'}
");
        }
Example #2
0
        private string Get_Update()
        {
            if (!LstInfoTable.Any(q => q.IsPK) || LstInfoTable.Count == LstInfoTable.Count(q => q.IsPK))
            {
                return("");
            }
            string passValue = "";
            bool   isFirst   = true;

            foreach (var item in LstInfoTable)
            {
                string s = isFirst ? "" : ",";
                passValue += $@"{s} ob.{item.Name.Replace(' ', '_')} ";
                isFirst    = false;
            }
            return($@"
public int {GetNameMethod(eMethod.Update)}({cDto} ob)
{'{'}
    return new {dbEntity}().{proc.GetName(eMethod.Update)[0]}({passValue});
{'}'}
");
        }
Example #3
0
        private string Get_GetBy()
        {
            if (LstInfoTable.Count(q => q.IsPK) < 1)
            {
                return(string.Empty);
            }
            var    lstKey = LstInfoTable.Where(q => q.IsPK).ToList();
            string param  = null;
            string value  = null;
            string result = "";

            foreach (var item in lstKey)
            {
                value   = item.Name;
                param   = $"{item.GetTypeCs()} {item.Name}";
                result += $@"
public {cDto} {GetNameMethod(eMethod.GetBy)}{item.Name}({param})
{'{'}
    return new {cDal}().{GetNameMethod(eMethod.GetBy)}{item.Name}({value});
{'}'}
";
            }
            return(result);
        }