public static bool StockCreate(Dictionary <string, object> data,
                                out string result,
                                out int productid,
                                out decimal quantity,
                                out UnitType unit,
                                out string comment)
 {
     result    = string.Empty;
     productid = Convert.ToInt32(data["productid"]);
     quantity  = Convert.ToDecimal(data["quantity"]);
     unit      = UnitType.adet;
     comment   = data["comment"].ToString();
     if (!Valid.ID(productid))
     {
         result = "{\"RESULT\":6}";
         return(false);
     }
     if (!Valid.Quantity(quantity))
     {
         result = "{\"RESULT\":10}";
         return(false);
     }
     if (!Valid.UnitTypeVal(Convert.ToInt16(data["unit"]), out unit))
     {
         result = "{\"RESULT\":11}";
         return(false);
     }
     return(true);
 }
 public static bool ProductGetById(Dictionary <string, object> data,
                                   out string result,
                                   out int productid)
 {
     result    = string.Empty;
     productid = Convert.ToInt32(data["productid"]);
     if (!Valid.ID(productid))
     {
         result = "{\"RESULT\":6}";
         return(false);
     }
     return(true);
 }
 public static bool StockDelete(Dictionary <string, object> data,
                                out string result,
                                out int stockid)
 {
     result  = string.Empty;
     stockid = Convert.ToInt32(data["stockid"]);
     if (!Valid.ID(stockid))
     {
         result = "{\"RESULT\":9}";
         return(false);
     }
     return(true);
 }
 public static bool StockReport(Dictionary <string, object> data,
                                out string result,
                                out int productid,
                                out string dummydata)
 {
     result    = string.Empty;
     productid = Convert.ToInt32(data["productid"]);
     dummydata = string.Empty;
     if (!Valid.ID(productid))
     {
         result = "{\"RESULT\":6}";
         return(false);
     }
     return(true);
 }
 public static bool ProductModify(Dictionary <string, object> data,
                                  out string result,
                                  out int productid,
                                  out string name,
                                  out string comment)
 {
     result    = string.Empty;
     productid = Convert.ToInt32(data["productid"]);
     name      = data["name"].ToString();
     comment   = data["comment"].ToString();
     if (!Valid.ID(productid))
     {
         result = "{\"RESULT\":6}";
         return(false);
     }
     if (!Valid.Name(name))
     {
         result = "{\"RESULT\":8}";
         return(false);
     }
     return(true);
 }