public async Task <IHttpActionResult> PostWeb_TrzIKala(string ace, string sal, string group, TrzIObject TrzIObject)
        {
            var    dataAccount = UnitDatabase.ReadUserPassHeader(this.Request.Headers);
            string con         = UnitDatabase.CreateConection(dataAccount[0], dataAccount[1], dataAccount[2], ace, sal, group, 0, "22", 9, 0);

            if (con == "ok")
            {
                string modeCode   = UnitPublic.SpiltCodeCama(TrzIObject.ModeCode);
                string kGruCode   = UnitPublic.SpiltCodeCama(TrzIObject.KGruCode);
                string thvlCode   = UnitPublic.SpiltCodeCama(TrzIObject.ThvlCode);
                string tGruCode   = UnitPublic.SpiltCodeCama(TrzIObject.TGruCode);
                string oprCode    = UnitPublic.SpiltCodeCama(TrzIObject.OprCode);
                string mkzCode    = UnitPublic.SpiltCodeCama(TrzIObject.MkzCode);
                string invCode    = UnitPublic.SpiltCodeCama(TrzIObject.InvCode);
                string statusCode = UnitPublic.SpiltCodeCama(TrzIObject.StatusCode);

                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select  top (10000) * FROM  dbo.Web_TrzIKala('{0}', '{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}') AS TrzI where 1 = 1 ",
                                           TrzIObject.azTarikh,
                                           TrzIObject.taTarikh,
                                           modeCode,
                                           kGruCode,
                                           thvlCode,
                                           tGruCode,
                                           mkzCode,
                                           oprCode,
                                           invCode,
                                           statusCode,
                                           dataAccount[2]
                                           );
                sql += UnitPublic.SpiltCodeAnd("KalaCode", TrzIObject.KalaCode);

                var listTrzI = UnitDatabase.db.Database.SqlQuery <Web_TrzIKala>(sql);
                return(Ok(listTrzI));
            }
            return(Ok(con));
        }
        public async Task <IHttpActionResult> PostWeb_TrzIKala(string userName, string password, string ace, string sal, string group, TrzIObject TrzIObject)
        {
            if (UnitDatabase.CreateConection(userName, password, ace, sal, group))
            {
                string sql = string.Format(CultureInfo.InvariantCulture,
                                           @"select * FROM  dbo.Web_TrzIKala('{0}', '{1}') AS TrzI where 1 = 1 ",
                                           TrzIObject.azTarikh, TrzIObject.taTarikh);
                //if (TrzIObject.InvCode != "0")
                //    sql += string.Format(" and InvCode = '{0}' ", TrzIObject.InvCode);

                if (TrzIObject.KGruCode != "0")
                {
                    sql += string.Format(" and KGruCode = '{0}' ", TrzIObject.KGruCode);
                }

                sql += UnitPublic.SpiltCodeAnd("InvCode", TrzIObject.InvCode);
                sql += UnitPublic.SpiltCodeAnd("KalaCode", TrzIObject.KalaCode);

                var listTrzI = UnitDatabase.db.Database.SqlQuery <Web_TrzIKala>(sql);
                return(Ok(listTrzI));
            }
            return(null);
        }