Exemplo n.º 1
0
        public override void SubmitEditableChange(EmployeeInfo emp, changeStatus nStatus, bool bCheckChanged, EditableInfo ei, Dictionary <string, object> row)
        {
            string sSql = "";

            BuildSubmitSql(emp, nStatus, ei, row, bCheckChanged, ref sSql);
            ExecCommandWithTransaction(sSql);
        }
Exemplo n.º 2
0
 private void ChangeStatus(string val)
 {
     if (statusStrip1.InvokeRequired)
     {
         var invoke = new changeStatus(ChangeStatus);
         Invoke(invoke, val);
     }
     else
     {
         if (val == I18N.GetString("Ready"))
         {
             pBar.Visible        = false;
             dgvMain.Enabled     = true;
             tssStatus.Text      = I18N.GetString("Ready");
             tssStatus.ForeColor = Color.Green;
         }
         else if (val == I18N.GetString("Wrong"))
         {
             pBar.Visible        = false;
             dgvMain.Enabled     = true;
             tssStatus.Text      = I18N.GetString("Wrong");
             tssStatus.ForeColor = Color.Red;
         }
         else
         {
             pBar.Visible        = true;
             dgvMain.Enabled     = false;
             tssStatus.Text      = val;
             tssStatus.ForeColor = Color.Blue;
         }
     }
 }
        private void OnTrackingFound()
        {
            Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true);
            Collider[] colliderComponents = GetComponentsInChildren <Collider>(true);

            // Enable rendering:
            foreach (Renderer component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (Collider component in colliderComponents)
            {
                component.enabled = true;
            }

            Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
            if (mTrackableBehaviour.TrackableName == "machineA")
            {
                ;
            }
            {
                Debug.Log("test_found");
                changeStatus val = new changeStatus();
            }
        }
Exemplo n.º 4
0
 public override void SubmitEditableChange(EmployeeInfo emp, changeStatus nStatus, bool bCheckChanged, string sEditableName, Dictionary <string, object> row)
 {
     foreach (EditableInfo ei in Common.EditableList)
     {
         if (sEditableName.Equals(ei.EditableName, StringComparison.OrdinalIgnoreCase))
         {
             SubmitEditableChange(emp, nStatus, bCheckChanged, ei, row);
         }
     }
 }
Exemplo n.º 5
0
        public override void SubmitEditableChange(EmployeeInfo emp, Dictionary <string, object>[] Rows, EditableInfo ei)
        {
            string sSql = "";

            foreach (Dictionary <string, object> row in Rows)
            {
                string sStatus = Cvt.ToString(row["__status"]);
                if (!string.IsNullOrEmpty(sStatus))
                {
                    changeStatus nStatus = (changeStatus)Enum.Parse(typeof(changeStatus), sStatus, true);
                    BuildSubmitSql(emp, nStatus, ei, row, true, ref sSql);
                }
            }
            ExecCommandWithTransaction(sSql);
        }
Exemplo n.º 6
0
        private void BuildSubmitSql(EmployeeInfo emp, changeStatus nStatus, EditableInfo ei, Dictionary <string, object> row, bool bCheckChanged, ref string sSql)
        {
            //if (ei.PrimaryFields == null || ei.PrimaryFields.Length == 0)
            //    return;

            //string sName = "";
            //if (row.ContainsKey(ei.PrimaryFields[0]))//第一个Name字段不能为空白
            //    sName = Cvt.ToString(row[ei.PrimaryFields[0]]);
            //sName = sName.Trim();
            //if (sName.Length > 0)
            {
                string sValList = "";
                string sSqlRow  = "";

                if (nStatus == changeStatus.Add)
                {
                    foreach (string sFld in ei.MasterTable.Fields)
                    {
                        AddFieldValue(nStatus, sFld, row, emp, "", ref sSqlRow, ref sValList);
                    }

                    if (sSqlRow.Length <= 0)
                    {
                        sSql += BuildInsert(ei.MasterTable.sName, sSqlRow, sValList);
                        sSql += "SET @nLastPrimaryID=last_insert_id();\n";
                    }
                    else
                    {
                        sSql += "SET @nLastPrimaryID=" + row[ei.sSlaveKey] + ";\n";
                    }

                    if (ei.SlaveTables != null)
                    {
                        foreach (EditableTable slave in ei.SlaveTables)
                        {
                            sValList = "";
                            sSqlRow  = "";
                            foreach (string sFld in slave.Fields)
                            {
                                AddFieldValue(nStatus, sFld, row, emp, ei.sSlaveKey, ref sSqlRow, ref sValList);
                            }

                            if (sSqlRow.Length > 0)
                            {
                                sSql += BuildInsert(slave.sName, sSqlRow, sValList);
                                string sForeignKeyInMaster = ei.ForeignKeyInMaster(slave.sName);
                                if (sForeignKeyInMaster.Length > 0)
                                {
                                    sSql += "UPDATE " + QuoteField(ei.MasterTable.sName) + " SET " + QuoteField(sForeignKeyInMaster) + "=last_insert_id() WHERE " + QuoteField("_ID") + "=@nLastPrimaryID;\n";
                                }
                            }
                        }
                    }
                }
                //else if (nStatus == changeStatus.Update)//没有列出的值的字段将置为NULL
                //{
                //    foreach (string sFld in ei.PrimaryFields)
                //        AddFieldValue(nStatus, sFld, row, emp, "", ref sSqlRow, ref sValList);
                //    sSql += "UPDATE " + QuoteField(ei.PrimaryTable) + " SET " + sSqlRow + " WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n";

                //    if (!string.IsNullOrEmpty(ei.HistoryTable))
                //    {
                //        //再构造添加到Histry表中的语句
                //        sValList = "";
                //        sSqlRow = "";
                //        foreach (string sFld in ei.HistoryFileds)
                //            AddFieldValue(changeStatus.Add, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);
                //        string sInsertSql = BuildInsert(ei.HistoryTable, sSqlRow, sValList);

                //        //先检查是否确实有更改
                //        if (!bCheckChanged)
                //            sSql += sInsertSql;
                //        else
                //        {
                //            sValList = "";
                //            sSqlRow = "";

                //            foreach (string sFld in ei.HistoryFileds)
                //                AddFieldValue(nStatus, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);
                //            sSql += "IF NOT EXISTS(SELECT * FROM " + QuoteField(ei.HistoryTable) + " WHERE " + QuoteField("_ID") + "=" + row["_ID"] + " AND " + sValList + ") THEN \n"
                //                 + sInsertSql
                //                 + "UPDATE " + QuoteField(ei.PrimaryTable) + " SET " + QuoteField("_Last_History") + "=last_insert_id() WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n"
                //                 + "END IF;\n";
                //        }
                //    }
                //}
                //else if (nStatus == changeStatus.AddHistory)//没有列出的值的字段将置最后一次的值
                else if (nStatus == changeStatus.Update || nStatus == changeStatus.AddHistory)//没有列出的值的字段将置最后一次的值
                {
                    //foreach (string sFld in ei.PrimaryFields)
                    //{
                    //    if (row.ContainsKey(sFld))
                    //        AddFieldValue(changeStatus.Update, sFld, row, emp, "", ref sSqlRow, ref sValList);
                    //}
                    //if (sSqlRow.Length > 0)
                    //    sSql += "UPDATE " + QuoteField(ei.PrimaryTable) + " SET " + sSqlRow + " WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n";

                    //if (!string.IsNullOrEmpty(ei.HistoryTable))
                    //{
                    //    //先构造添加到Histry表中的语句
                    //    sValList = "";
                    //    sSqlRow = "";
                    //    foreach (string sFld in ei.HistoryFileds)
                    //        AddFieldValue(changeStatus.AddHistory, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);

                    //    string sInsertSql = " SELECT " + QuoteField(ei.ForeignKeyInPrimary) + " INTO @nLastID FROM " + QuoteField(ei.PrimaryTable) + " WHERE  " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + " ;\n"
                    //        + " INSERT INTO " + QuoteField(ei.HistoryTable) + "(" + sSqlRow + ") \n"
                    //        + " SELECT " + sValList + " FROM " + QuoteField(ei.HistoryTable) + " WHERE " + QuoteField("_ID") + "=@nLastID;\n";

                    //    //再决定是是否需要检查确实有更改
                    //    if (!bCheckChanged)
                    //        sSql += sInsertSql;
                    //    else
                    //    {
                    //        sValList = "";
                    //        sSqlRow = "";

                    //        foreach (string sFld in ei.HistoryFileds)
                    //        {
                    //            if (row.ContainsKey(sFld))
                    //                AddFieldValue(changeStatus.Where, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);
                    //        }
                    //        if (sSqlRow.Length > 0)
                    //        {
                    //            string sUpdateSql ="";
                    //            if (!string.IsNullOrEmpty(ei.ForeignKeyInPrimary))
                    //                sUpdateSql = " UPDATE " + QuoteField(ei.PrimaryTable) + " SET "
                    //                    + QuoteField(ei.ForeignKeyInPrimary) + "=last_insert_id() WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n";

                    //            sSql += "IF NOT EXISTS(SELECT * FROM " + QuoteField(ei.HistoryTable) + " WHERE  " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + " AND " + sSqlRow + ") THEN \n"
                    //                + sInsertSql
                    //                + sUpdateSql
                    //                + "END IF;\n";
                    //        }
                    //    }
                    //}
                }
            }
        }
Exemplo n.º 7
0
        private void AddFieldValue(changeStatus nStatus, string sFld, Dictionary <string, object> row, EmployeeInfo emp, string HistoryForeignKey, ref string sSql, ref string sValList)
        {
            string sVal = QuoteNull;
            object val  = null;

            if (row.ContainsKey(sFld))
            {
                val = row[sFld];
            }
            else if (nStatus == changeStatus.AddHistory)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }
                sSql += QuoteField(sFld);

                if (sValList.Length > 0)
                {
                    sValList += ",";
                }

                if (sFld.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    sFld.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sValList += FuncCurrentTimestamp;
                }
                else
                {
                    sValList += QuoteField(sFld);
                }

                return;
            }
            else if (nStatus == changeStatus.Where)//条件语句不关心没有给值的字段
            {
                return;
            }

            if (val != null && val.GetType() == typeof(string))
            {
                if (Cvt.IsNumerical(val))
                {
                    sVal = val.ToString();
                }
                else
                {
                    sVal = QuoteValue(val.ToString());
                }
            }
            else if (sFld.Equals("_Employee_Update", StringComparison.OrdinalIgnoreCase))
            {
                if (nStatus == changeStatus.Where)
                {
                    return;
                }

                sVal = emp._Employee.ToString();
            }
            else if (sFld.Equals("_Site", StringComparison.OrdinalIgnoreCase))
            {
                sVal = emp._Site_Working.ToString();
            }
            else if (sFld.Equals("_Project", StringComparison.OrdinalIgnoreCase))
            {
                sVal = emp._Project_Working.ToString();
            }
            else if (sFld.Equals(HistoryForeignKey, StringComparison.OrdinalIgnoreCase) && nStatus == changeStatus.Add)
            {
                sVal = "@nLastPrimaryID";
            }
            else
            {
                try
                {
                    sVal = Convert.ToInt32(val).ToString();
                }
                catch (Exception)
                {
                }
            }


            if (nStatus == changeStatus.Add)
            {
                if (sFld.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) == false &&
                    sFld.Equals("Create_Time", StringComparison.OrdinalIgnoreCase) == false)
                {
                    if (sSql.Length > 0)
                    {
                        sSql += ",";
                    }
                    sSql += QuoteField(sFld);

                    if (sValList.Length > 0)
                    {
                        sValList += ",";
                    }
                    sValList += sVal;
                }
            }
            else if (nStatus == changeStatus.Update)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }

                if (sFld.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    sFld.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sSql += QuoteField(sFld) + "=" + FuncCurrentTimestamp;
                }
                else
                {
                    sSql += QuoteField(sFld) + "=" + sVal;
                }
            }
            else if (nStatus == changeStatus.Where)
            {
                if (sSql.Length > 0)
                {
                    sSql += " AND ";
                }

                if (sFld.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    sFld.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    return;//条件语句不关心创建时间或更新时间
                }
                else
                {
                    sSql += QuoteField(sFld) + "=" + sVal;
                }
            }
            else if (nStatus == changeStatus.AddHistory)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }
                sSql += QuoteField(sFld);

                if (sValList.Length > 0)
                {
                    sValList += ",";
                }

                if (sFld.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    sFld.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sValList += FuncCurrentTimestamp;
                }
                else
                {
                    sValList += sVal;
                }
            }
        }
Exemplo n.º 8
0
 public abstract void SubmitEditableChange(EmployeeInfo emp, changeStatus nStatus, bool bCheckChanged, EditableInfo ei, Dictionary <string, object> row);
Exemplo n.º 9
0
        private void BuildSubmitSql(EmployeeInfo emp, changeStatus nStatus, EditableInfo ei, Dictionary <string, object> row, bool bCheckChanged, ref string sSql)
        {
            //if (ei.PrimaryFields == null || ei.PrimaryFields.Length == 0)
            //    return;

            //string sName = "";
            //if (row.ContainsKey(ei.PrimaryFields[0]))//第一个Name字段不能为空白
            //    sName = Cvt.ToString(row[ei.PrimaryFields[0]]);
            //sName = sName.Trim();
            //if (sName.Length > 0)
            {
                string sValList = "";
                string sSqlRow  = "";
                if (string.IsNullOrEmpty(sSql))
                {
                    sSql = "DECLARE @nLastPrimaryID BIGINT,@nLastID BIGINT; \n";
                }

                if (nStatus == changeStatus.Add)
                {
                    foreach (Field fld in ei.MasterTable.Fields)
                    {
                        //if (fld.editor != Editor.none)
                        AddFieldValue(nStatus, fld, row, emp, "", ref sSqlRow, ref sValList);
                    }


                    if (sSqlRow.Length > 0)
                    {
                        sSql += BuildInsert(ei.MasterTable.sName, sSqlRow, sValList);
                        sSql += "SET @nLastPrimaryID=" + FuncLastInsertId + ";\n";
                    }
                    else
                    {
                        sSql += "SET @nLastPrimaryID=" + row[ei.sSlaveKey] + ";\n";
                    }

                    if (ei.SlaveTables != null)
                    {
                        foreach (EditableTable slave in ei.SlaveTables)
                        {
                            sValList = "";
                            sSqlRow  = "";
                            foreach (Field fld in slave.Fields)
                            {
                                AddFieldValue(nStatus, fld, row, emp, ei.sSlaveKey, ref sSqlRow, ref sValList);
                            }

                            if (sSqlRow.Length > 0)
                            {
                                sSql += BuildInsert(slave.sName, sSqlRow, sValList);
                                string sForeignKeyInMaster = ei.ForeignKeyInMaster(slave.sName);
                                if (sForeignKeyInMaster.Length > 0)
                                {
                                    sSql += "UPDATE " + QuoteField(ei.MasterTable.sName) + " SET " + QuoteField(sForeignKeyInMaster) + "=" + FuncLastInsertId + " WHERE " + QuoteField("_ID") + "=@nLastPrimaryID;\n";
                                }
                            }
                        }
                    }
                }
                //else if (nStatus == changeStatus.Update)//没有列出的值的字段将置为NULL
                //{
                //    foreach (string sFld in ei.PrimaryFields)
                //        AddFieldValue(nStatus, sFld, row, emp, "", ref sSqlRow, ref sValList);
                //    sSql += "UPDATE " + QuoteField(ei.PrimaryTable) + " SET " + sSqlRow + " WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n";

                //    if (!string.IsNullOrEmpty(ei.HistoryTable))
                //    {
                //        //再构造添加到Histry表中的语句
                //        sValList = "";
                //        sSqlRow = "";
                //        foreach (string sFld in ei.HistoryFileds)
                //            AddFieldValue(changeStatus.Add, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);
                //        string sInsertSql = BuildInsert(ei.HistoryTable, sSqlRow, sValList);

                //        //先检查是否确实有更改
                //        if (!bCheckChanged)
                //            sSql += sInsertSql;
                //        else
                //        {
                //            sValList = "";
                //            sSqlRow = "";

                //            foreach (string sFld in ei.HistoryFileds)
                //                AddFieldValue(nStatus, sFld, row, emp, ei.HistoryForeignKey, ref sSqlRow, ref sValList);
                //            sSql += "IF NOT EXISTS(SELECT * FROM " + QuoteField(ei.HistoryTable) + " WHERE " + QuoteField("_ID") + "=" + row["_ID"] + " AND " + sValList + ") THEN \n"
                //                 + sInsertSql
                //                 + "UPDATE " + QuoteField(ei.PrimaryTable) + " SET " + QuoteField("_Last_History") + "=last_insert_id() WHERE " + QuoteField("_ID") + "=" + row[ei.HistoryForeignKey] + ";\n"
                //                 + "END IF;\n";
                //        }
                //    }
                //}
                //else if (nStatus == changeStatus.AddHistory)//没有列出的值的字段将置最后一次的值
                else if (nStatus == changeStatus.Update || nStatus == changeStatus.AddHistory)//没有列出的值的字段将置最后一次的值
                {
                    foreach (Field Fld in ei.MasterTable.Fields)
                    {
                        if (row.ContainsKey(Fld))
                        {
                            AddFieldValue(changeStatus.Update, Fld, row, emp, "", ref sSqlRow, ref sValList);
                        }
                    }

                    string sPrimaryKey = ei.sSlaveKey;
                    if (!row.ContainsKey(sPrimaryKey))
                    {
                        sPrimaryKey = "_ID";
                    }

                    if (sSqlRow.Length > 0)
                    {
                        sSql += "UPDATE " + QuoteField(ei.MasterTable.sName) + " SET " + sSqlRow + " WHERE " + QuoteField("_ID") + "=" + row[sPrimaryKey] + ";\n";
                    }

                    if (ei.SlaveTables != null)
                    {
                        foreach (EditableTable slave in ei.SlaveTables)
                        {
                            string sForeignKeyInMaster = ei.ForeignKeyInMaster(slave.sName);
                            if (sForeignKeyInMaster.Length == 0)
                            {
                                continue;
                            }

                            //先构造添加到Histry表中的语句
                            sValList = "";
                            sSqlRow  = "";
                            foreach (Field Fld in slave.Fields)
                            {
                                AddFieldValue(changeStatus.AddHistory, Fld, row, emp, ei.sSlaveKey, ref sSqlRow, ref sValList);
                            }

                            string sSelectPrimary = "SELECT @nLastID=" + QuoteField(sForeignKeyInMaster) + " FROM " + QuoteField(ei.MasterTable.sName) + " WHERE  " + QuoteField("_ID") + "=" + row[sPrimaryKey] + " ;\n";

                            string sInsertSql = " INSERT INTO " + QuoteField(slave.sName) + "(" + sSqlRow + ") \n"
                                                + "    SELECT " + sValList + " FROM " + QuoteField(slave.sName) + " WHERE " + QuoteField("_ID") + "=@nLastID;\n";

                            //再决定是是否需要检查确实有更改
                            if (!bCheckChanged)
                            {
                                sSql += sSelectPrimary + sInsertSql;
                            }
                            else
                            {
                                sValList = "";
                                sSqlRow  = "";

                                foreach (Field Fld in slave.Fields)
                                {
                                    if (row.ContainsKey(Fld) && ei.sSlaveKey.Equals(Fld, StringComparison.OrdinalIgnoreCase) == false)
                                    {
                                        AddFieldValue(changeStatus.Where, Fld, row, emp, ei.sSlaveKey, ref sSqlRow, ref sValList);
                                    }
                                }
                                if (sSqlRow.Length > 0)
                                {
                                    string sUpdateSql = "";
                                    if (!string.IsNullOrEmpty(sForeignKeyInMaster))
                                    {
                                        sUpdateSql = " UPDATE " + QuoteField(ei.MasterTable.sName) + " SET "
                                                     + QuoteField(sForeignKeyInMaster) + "=" + FuncLastInsertId + " WHERE " + QuoteField("_ID") + "=" + row[sPrimaryKey] + ";\n";
                                    }

                                    sSql += sSelectPrimary;
                                    sSql += "IF NOT EXISTS(SELECT * FROM " + QuoteField(slave.sName) + " WHERE  " + QuoteField("_ID") + "=@nLastID AND " + sSqlRow + ") \n"
                                            + "BEGIN\n"
                                            + sInsertSql
                                            + sUpdateSql
                                            + "END;\n";
                                }
                            }
                        }
                    }//END OF if (ei.SlaveTables != null)
                }
            }
        }
Exemplo n.º 10
0
        private void AddFieldValue(changeStatus nStatus, Field Fld, Dictionary <string, object> row, EmployeeInfo emp, string HistoryForeignKey, ref string sSql, ref string sValList)
        {
            //if (Fld.editor == Editor.none)
            //    return;

            string sVal = QuoteNull;
            object val  = null;

            if ((Fld.editor & Editor.order) != Editor.none)
            {
                val = row["__index"];
            }
            else if (row.ContainsKey(Fld) && row[Fld] != null)
            {
                val = row[Fld];
                if (Fld.type == FieldType.Int && Cvt.IsNumerical(val) == false)
                {
                    val = null;
                }
            }
            else if (nStatus == changeStatus.AddHistory)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }
                sSql += QuoteField(Fld);

                if (sValList.Length > 0)
                {
                    sValList += ",";
                }

                if (Fld.name.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    Fld.name.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sValList += FuncCurrentTimestamp;
                }
                else
                {
                    sValList += QuoteField(Fld);
                }

                return;
            }
            else if (nStatus == changeStatus.Where)//条件语句不关心没有给值的字段
            {
                return;
            }

            if (val != null && val.GetType() == typeof(string))
            {
                if (Cvt.IsNumerical(val))
                {
                    sVal = val.ToString();
                }
                else
                {
                    sVal = QuoteValue(val.ToString());
                }
            }
            else if (Fld.name.Equals("_Employee_Update", StringComparison.OrdinalIgnoreCase))
            {
                if (nStatus == changeStatus.Where)
                {
                    return;
                }

                sVal = emp._Employee.ToString();
            }
            //else if (val == null && Fld.name.Equals("_Site", StringComparison.OrdinalIgnoreCase))
            //{
            //    sVal = emp._Site_Working.ToString();
            //}
            //else if (val == null && Fld.name.Equals("_Project", StringComparison.OrdinalIgnoreCase))
            //{
            //    sVal = emp._Project_Working.ToString();
            //}
            else if (Fld.name.Equals(HistoryForeignKey, StringComparison.OrdinalIgnoreCase) && nStatus == changeStatus.Add)
            {
                sVal = "@nLastPrimaryID";
            }
            else
            {
                try
                {
                    if (val != null)
                    {
                        sVal = Convert.ToInt64(val).ToString();
                    }
                    else if (nStatus != changeStatus.AddHistory)
                    {
                        return;
                    }
                }
                catch (Exception)
                {
                }
            }


            if (nStatus == changeStatus.Add)
            {
                if (Fld.name.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) == false &&
                    Fld.name.Equals("Create_Time", StringComparison.OrdinalIgnoreCase) == false)
                {
                    if (sSql.Length > 0)
                    {
                        sSql += ",";
                    }
                    sSql += QuoteField(Fld);

                    if (sValList.Length > 0)
                    {
                        sValList += ",";
                    }
                    sValList += sVal;
                }
            }
            else if (nStatus == changeStatus.Update)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }

                if (Fld.name.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    Fld.name.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sSql += QuoteField(Fld) + "=" + FuncCurrentTimestamp;
                }
                else
                {
                    sSql += QuoteField(Fld) + "=" + sVal;
                }
            }
            else if (nStatus == changeStatus.Where)
            {
                if (Fld.name.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    Fld.name.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    return;//条件语句不关心创建时间或更新时间
                }
                else
                {
                    if (sSql.Length > 0)
                    {
                        sSql += " AND ";
                    }
                    sSql += QuoteField(Fld) + "=" + sVal;
                }
            }
            else if (nStatus == changeStatus.AddHistory)
            {
                if (sSql.Length > 0)
                {
                    sSql += ",";
                }
                sSql += QuoteField(Fld);

                if (sValList.Length > 0)
                {
                    sValList += ",";
                }

                if (Fld.name.Equals("Update_Time", StringComparison.OrdinalIgnoreCase) ||
                    Fld.name.Equals("Create_Time", StringComparison.OrdinalIgnoreCase))
                {
                    sValList += FuncCurrentTimestamp;
                }
                else
                {
                    sValList += sVal;
                }
            }
        }
Exemplo n.º 11
0
 //ביטול התנדבות חד פעמי
 public bool CancellationIndividualdVolunteering([FromBody] changeStatus volunteerOfChildID)
 {
     return(VolunteerOfChildBL.CancellationIndividualdVolunteering(volunteerOfChildID.id));
 }
Exemplo n.º 12
0
 //דוחה בקשת התנדבות
 public bool SpurnedVolunteering([FromBody] changeStatus volunteerOfChildID)
 {
     return(VolunteerOfChildBL.SpurnedVolunteering(volunteerOfChildID.id));
 }
Exemplo n.º 13
0
 private void ChangeStatus(string val)
 {
     if (statusStrip1.InvokeRequired)
     {
         var invoke = new changeStatus(ChangeStatus);
         Invoke(invoke, val);
     }
     else
     {
         if (val == I18N.GetString("Ready"))
         {
             pBar.Visible = false;
             dgvMain.Enabled = true;
             tssStatus.Text = I18N.GetString("Ready");
             tssStatus.ForeColor = Color.Green;
         }
         else if (val == I18N.GetString("Wrong"))
         {
             pBar.Visible = false;
             dgvMain.Enabled = true;
             tssStatus.Text = I18N.GetString("Wrong");
             tssStatus.ForeColor = Color.Red;
         }
         else
         {
             pBar.Visible = true;
             dgvMain.Enabled = false;
             tssStatus.Text = val;
             tssStatus.ForeColor = Color.Blue;
         }
     }
 }